capabilities.work

Bulk Upsert Records

A 5-step recipe with Salesforce. We can help you get access.

Recipe · 5 steps

Bulk Upsert Records

Bulk upsert records into a Salesforce object by external Id via the Bulk API 2.0 ingest lifecycle.

  1. Create a new Bulk API 2.0 ingest job configured for the upsert operation against the target object, keyed on the supplied external Id field. The job starts in the Open state.
  2. Upload the CSV payload to the open ingest job. The header row must include the external Id field used for matching.
  3. Close the ingest job by setting its state to UploadComplete, which tells Salesforce to begin processing the upserts.
  4. Poll the ingest job state. When the job reaches JobComplete, continue to retrieve results; while still InProgress or UploadComplete, loop back to poll again; if the job Failed or Aborted, stop the workflow.
  5. Retrieve the CSV of successfully processed records once the job has reached JobComplete. Each row includes the added sf__Id and sf__Created columns.
What you'll need to have ready
  • object: The API name of the SObject to upsert records into (e.g. Account).
  • externalIdFieldName: The API name of the external Id field used to match existing records for the upsert (e.g. External_Id__c).
  • csvData: CSV payload with a header row of field API names (including the external Id field) and one record per subsequent row.
  • lineEnding: Line ending used in the CSV data (LF or CRLF). Defaults to LF.
For your developer

Arazzo workflow salesforce:bulk-upsert-records, 5 operations: createIngestJob → uploadJobData → updateIngestJob → getIngestJobInfo → getSuccessfulResults. Specs on APIs.io.