Reading Time: 6 minutes

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.

latest report
Learn why we are the Leaders in API management and iPaaS

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 . You will see a result similar to the following in the browser.

{
  "operation": "insert",
  "jobType": "V2Ingest",
  "object": "Contact",
  "apexProcessingTime": 0,
  "columnDelimiter": "COMMA",
  "retries": 0,
  "systemModstamp": "2018-08-08T22:10:11.000+0000",
  "state": "InProgress",
  "apiVersion": "42.0",
  "concurrencyMode": "Parallel",
  "totalProcessingTime": 0,
  "createdDate": "2018-08-08T22:10:09.000+0000",
  "createdById": "0051a000000aDICAA2",
  "numberRecordsFailed": 0,
  "apiActiveProcessingTime": 0,
  "lineEnding": "LF",
  "contentType": "CSV",
  "id": "7501a00000EMkGeAAL",
  "numberRecordsProcessed": 0
}

To check the status of your bulk job, please go to:. (You need to add the ID you receive from Salesforce when you hit ). You should see a similar result to the code below:

{
  "operation": "insert",
  "jobType": "V2Ingest",
  "object": "Contact",
  "apexProcessingTime": 0,
  "columnDelimiter": "COMMA",
  "retries": 0,
  "systemModstamp": "2018-08-08T22:10:13.000+0000",
  "state": "JobComplete",
  "apiVersion": "42.0",
  "concurrencyMode": "Parallel",
  "totalProcessingTime": 731,
  "createdDate": "2018-08-08T22:10:09.000+0000",
  "createdById": "0051a000000aDICAA2",
  "numberRecordsFailed": 0,
  "apiActiveProcessingTime": 633,
  "lineEnding": "LF",
  "contentType": "CSV",
  "id": "7501a00000EMkGeAAL",
  "numberRecordsProcessed": 100
}

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 . (You need to add the ID you receive from Salesforce when you hit )

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.