Contact us
Global Headquarters,
645 Hulet Drive,
Bloomfield Hills,
Michigan 48302
Phone: (248) 869-0080
Global Headquarters, 645 Hulet Drive, Bloomfield Hills, Michigan 48302
Phone: (248) 869-0080
Salesforce Bulk API v2.0 using Mulesoft Connector
When dealing with a single table or object in Salesforce and processing a large volume of data, leveraging the Bulk API v2 is the most suitable approach. This method involves creating a job ID, uploading your data to Salesforce, and letting the Salesforce platform manage the entire process, including job status notifications.
You can find the details of Bulk API jobs and details on Salesforce Developer Guide for Bulk API 2.0. In here, I have tried to summarize Bulk API v2 for you using the flow diagram for a common use case where operations on job can be :
Let’s discuss the some of the operations on the Mulesoft Saleforce connector associated with Bulk API v2.
1. Create job bulk api v2: This connector will pick up the payload in CSV format and upload the job while creating a job ID for ya. Your response will have:
{ "id": "7508b00000cs0QTAAY", "operation": "update", "object": "Asset", "createdById": "0058b00000G13lcAAB", "createdDate": "2023-11-07T05:47:51.000+0000", "systemModstamp": "2023-11-07T05:47:51.000+0000", "state": "Open", "concurrencyMode": "Parallel", "contentType": "CSV", "apiVersion": 58.0, "contentUrl": "services/data/v58.0/jobs/ingest/7508b00000cs0QTAAY/batches", "lineEnding": "LF", "columnDelimiter": "COMMA" }
2. Get job state bulk api v2: Use this connector to get the job current state of processing for the job. Values include:
{ "id": "7508b00000cs0QTAAY", "operation": "update", "object": "Asset", "createdById": "0058b00000G13lcAAB", "createdDate": "2023-11-07T05:47:51.000+0000", "systemModstamp": "2023-11-07T05:48:38.000+0000", "state": "JobComplete", "concurrencyMode": "Parallel", "contentType": "CSV", "apiVersion": 58.0, "jobType": "V2Ingest", "lineEnding": "LF", "columnDelimiter": "COMMA", "numberRecordsProcessed": 500, "numberRecordsFailed": 500, "retries": 0, "totalProcessingTime": 137, "apiActiveProcessingTime": 11, "apexProcessingTime": 0 }
3. Retrieve job successful results bulk v 2: Use this connector to get the successful records results. The result will look like
"sf__Id","sf__Created",(CSV payload)
4. Retrieve job failed results bulk v2: Use this connector to get the failed records results. The result will look like
"sf__Id","sf__Error",(CSV payload)
5. Retrieve job unprocessed results bulk v2: Use this connector to get the unprocessed records results. Results are not recorded for batches that exceed the daily batch allocation.The result will look like
(CSV payload that was not processed during the job)- order not maintained
6. Delete job bulk api v2: This connector will ask for JobID. If the current state is UploadComplete, JobComplete, Aborted, or Failed. The job can be deleted.
Return Code 204 for successful job deletion
7. Abort job bulk api v2: Use this if you wish to abort a job while it is in progress. You can abort a job if you created it or if you have the “Manage Data Integrations” permission.
You can also try the operations using the Salesforce Platform API for Bulk API 2.0. Just fork it onto your user.
Use trailhead exercise Platform API Basics-Bulk API 2.0 to enhance your knowledge on Bulk API v2.0
More Posts
Global Headquarters,
645 Hulet Drive,
Bloomfield Hills,
Michigan 48302
Phone: (248) 869-0080
Global Headquarters, 645 Hulet Drive, Bloomfield Hills, Michigan 48302
Phone: (248) 869-0080
Copyright © 2024 Openlogix Corp. | All rights reserved