- I have Account with user id as external id.
- I have a record of Account with user id
123
created 2 months ago. - I have an upsert job created through bulk API yesterday with user id as
externalIdFieldName
. It was trying to upsert Account with user id123
and all the other fields. - It turns out that another Account with user id
123
was created by the upsert job
Question: why another Account was created instead of updating the old record with user id 123
?
From my understanding, the upsert job will lookup the records with the external id. If it find one matching, it will be updated; otherwise, a new record will be created.
So in this circumstances, why a duplicate record could be created?
Code to create Bulk upsert job:
$params = array(
"externalIdFieldName" => 'User_ID__c',
"object" => 'Account',
"operation" => 'upsert'
);
$path = "/services/data/v41.0/jobs/ingest";
$c = curl_init();
curl_setopt($c, CURLOPT_POST, 1);
$encodedParams = json_encode($params);
curl_setopt($c, CURLOPT_POSTFIELDS,$encodedParams);
// url will be look like csxx.salesforce.com/services/data/v41.0/jobs/ingest
curl_setopt($c, CURLOPT_URL, $this->host . $path);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout/1000);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$header = array('Content-type: application/json', 'Authorization: Bearer '. $this->sessionId);
curl_setopt($c, CURLOPT_HTTPHEADER, $header);
data = curl_exec($c);
123
differ in case?