Upsert record in Salesforce using Mulesoft

Use pipe delimited file to upsert record in Mulesoft 3

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

  1. Path
  2. 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

Configure Salesforce Connector in Mulesoft 3
Configure Salesforce Connector in Mulesoft 3

Step 3 is to bring Transform Message between File and Salesforce component in workspace. Right click on Payload and select Set Metadata

Set Metadata on Transform Message

After clicking Set Metadata, below screen will appear. We need to choose CSV as Type and add Headers manually.

Mulesoft Transformation Message Metadata
Mulesoft Transformation Message Metadata

Next step is to inform Mule that this CSV file would be delimited using pipe operator. Select Transform message and click on Reader Configuration

Reader Configuration in Transform Message - Mulesoft 3
Reader Configuration in Transform Message – Mulesoft 3

when popup comes up, set separator as Pipe (|) operator instead of comma

Mulesoft 3 - Transform Message Reader Configuration
Mulesoft 3 – Transform Message Reader Configuration

Step 4 : Bring Logger in workspace to show output of Salesforce operation

Logger in Mulesoft 3
Logger in Mulesoft 3

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.

Posted

in

,

by


Related Posts

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Jitendra Zaa

Subscribe now to keep reading and get access to the full archive.

Continue Reading