Introducing Bulk API v2 support with the Salesforce Connector

salesforce connector

One of main use cases with Salesforce that MuleSoft customers use involves uploading records that are stored in CSV format to Salesforce. MuleSoft has provided various ways to fulfill this use case. We have dataloader.io, the most popular Data Loader for Salesforce on Salesforce AppExchange, and also have Anypoint Platform’s Salesforce Connector with various operations.

We added another option to help you easily accomplish the above use case. We are pleased to announce Bulk API v2.0 support for the Salesforce Connector.

Bulk API v2.0 is available in API version 41.0 and later. Compared to Bulk API v1.0, Salesforce has dramatically simplified the pre-processing step of Bulk API. In this blog, we will walk you through how to bulk upload your contact records in CSV format to Salesforce through Bulk API v2.0.

1. As a first step, please download this simple Mule app and import it to Anypoint Studio 7. Once you import it, you will see the following four flows in Studio 7.

    

2. As the second step, download the Salesforce Connector v9.3.1 from Anypoint Exchange in Anypoint Studio 7.

3. Let’s configure the Salesforce Connector. To configure the connector, go to Global Elements, find “Salesforce Config,” and then click “Edit.”

4. In the “Salesforce_Config,” you can specify the configuration for Salesforce. Please add your Salesforce credentials in the configuration.

5. Now, it is time to double check the File Path for File Connector (Read Operation). It is preconfigured to pick up MOCK_DATA.csv from the local machine. Please make sure the File Path points to where you have a CSV file.

If you don’t have a CSV file ready yet, you can download a mock contact information I created for this demo app. The demo app is ready to be run.

After you run the demo app in Studio, use a browser to go to http://localhost:8081/createJob. You will see a result similar to the following in the browser.

To check the status of your bulk job, please go to:http://localhost:8081/getJobState?id=7501a00000EMkGeAAL. (You need to add the ID you receive from Salesforce when you hit http://localhost:8081/createJob). You should see a similar result to the code below:

numberRecordsProcessed shows 100 contacts have been inserted to Salesforce. You just completed a bulk upload of your contact records to Salesforce with one API call.

You can also check a status of individual record by hitting http://localhost:8081/getResults?id=7501a00000EMkGeAAL. (You need to add the ID you receive from Salesforce when you hit http://localhost:8081/createJob)

For new users, try the above example to get started, and for others, please share with us how you plan to use Bulk API v2.0 support with the Salesforce Connector!

Also, be sure to explore Anypoint Exchange to see other resources you can use today.


 


We'd love to hear your opinion on this post