function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Varun ChopraVarun Chopra 

Upsert Failed while upserting using unique external Id

Hi

I am upserting records using curl php in salesfroce using following code:
$url = https://na1.salesforce.com/…/Acco…/customExtIdField__c/11999

$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $requestType);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json','Content-Length: ' . strlen($content), 'Content-Type: application/json','Authorization: OAuth '.$atoken));
It was working fine , until I was using normal external Id, Today I have modified my external Id and set it as unique in salesforce and now my code is throwing this error.

[message] => duplicate value found: customExtIdField__c duplicates value on record with id: 001d0000003ja0H [errorCode] => DUPLICATE_VALUE [fields] => Array ( )
Please help , Thanks In Advance !