Processing Comma Separated file is out of box but what if text file is delimited using comma.
In this post, we will read Pipe delimited file and upsert record in Salesforce. Instead of upserting record in Salesforce, you can do anything else you want to.
This is how final job will look like :
Pipe delimited file that we want to upload looks like, SAART Account Id is external id that would be used for upsert operation.
NAME|SAART ACCOUNT ID AT&T|2 IBM|1 Salesforce|3
Step 1 is to bring File component in Mule 3 workspace. only two settings I configured
- File Name in “File Name Regex Filter”
Step 2 is to bring Salesforce component. Configure as shown in below image. In my case I’m going to upsert Account on basis of external Id field SAART Account Id
Step 3 is to bring Transform Message between File and Salesforce component in workspace. Right click on Payload and select Set Metadata
After clicking Set Metadata, below screen will appear. We need to choose CSV as Type and add Headers manually.
Next step is to inform Mule that this CSV file would be delimited using pipe operator. Select Transform message and click on Reader Configuration
when popup comes up, set separator as Pipe (|) operator instead of comma
Step 4 : Bring Logger in workspace to show output of Salesforce operation
Running it : Start Mulesoft and put valid file in folder mentioned in Step 1. Mule will process it, delete it and show log in console.