I'm trying to upsert a record using an external Id with composite API.
my external Id is (External ID) (Unique Case Insensitive)
- to be precise - I created this field only with the external Id checkbox checked, and after some time I turned it also to be unique.
When I'm trying to update a value that already exists in my system using upsert - (even if it only one record like the JSON below) I'm getting an error :
Duplicate value found: customObject__c duplicates value on record with id: xxxxxxxx
Which of course I have only one record with that current external Id.
After some investigation, I found out that if I'm creating a new record Its Inserted or updated as expected when using the same call.
But when I'm dealing with a record that was in my DB before I turned the external Id field to be unique, I'm getting this above error.
What I'm doing :
https://xxx.salesforce.com/services/data/v50.0/composite/sobjects/customObject__c/CustomExternalIdField__c
{
"allOrNone": false,
"records": [{
"CustomExternalIdField__c":"503",
"field1__c":"RS",
"field2__c":"PN",
"field3__c":"PEN",
"Name":"Name",
"field4__c":"RE",
"attributes": {
"type": "customObject__c"
}
}]
}
P.S
I'm doing this API call on 5 different Objects which all of them have an externalId that changed to be also unique over time - and Its working as excepted.
Any Ideas please?