I'm using the Bulk API to upsert records into Salesforce. The Request contains both an External ID and also a Salesforce Id. Even though in the job detail references using the external Id, will Salesforce override this and use the Id?


   "external_id__c": "12719",
   "Id": "0031I000017FxLsQAK"
   "FirstName": "xxxxx",
   "LastName": "xxxxxx"

We did some testing and found that if specify an SFID ("Id") that does not exist in the request upsert. The following error occurs:

  "success" : false,
  "created" : true,
  "id" : null,
  "errors" : [ {
    "message" : "cannot specify Id in an insert call",
    "fields" : [ "Id" ],
    "extendedErrorDetails" : null

This indicates that the record does not exist and will insert. However, as the newly inserted record will have different SFID to one specified in the request it fails.


Based upon my own testing, if the payload contains an SFID it will use this as a unique identifier. So even though the jobs External ID is set to another field if the SFID does not match, the record will not be updated or created. In other words, the SFID overrules the External Id

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.