0

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?

e.g.

{
   "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" ],
    "statusCode" : "INVALID_FIELD_FOR_INSERT_UPDATE",
    "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.

0

Based upon my own testing if the payload contains a 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.

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.