Iam using Salesforce Bulk API to upsert records from my application to salesforce. I have a confusion in Upsert.Now I already have a account named XYZ in salesforce .I create an external id as myexternalid_c. Now I send my json data with XYZ account (Along with external ID) from my application.Will duplicate be avoided.If so can Any one explain the logic how salesforce deals with it
The records you are upserting can be matched against a Id or a external Id field.
Below is a excerpt from salesforce documentation:
Upsert uses the external ID to determine whether it should create a new record or update an existing one:
- If the external ID is not matched, then a new record is created.
- If the external ID is matched once, then the existing record is updated.
- If the external ID is matched multiple times, then an error is reported.
- When batch updating multiple records where the external ID is the same for two or more records in your batch call, those records will
be marked as errors in the UpsertResult file. The records will be
neither created or updated.
Also, a nice blog has been written on the working. Hope this helps.