Loading

Differences between the 'External ID' field and the 'Unique ID' field setting

Publiceringsdatum: Apr 14, 2025
Beskrivning


Here are the differences between External IDs and Unique IDs for fields on Salesforce records.

Lösning

'External ID' fields

The 'External ID' field may be used to reference an ID from another, external system. This ID can server as a bridge to external systems within Salesforce.
External IDs are searchable in Salesforce and you can also use the Insert API call with the External ID to refer to records when making changes via the Data Loader.

Example use case for External IDs:
If you have an Oracle Financials system that links with Salesforce, it may be more efficient for you to refer to the Oracle ID of account records from within Salesforce. In this case, you can create an 'External ID' in Salesforce and use it to capture and display the Oracle ID for each account.

Note: You can have multiple records with the same External ID, though this it is not recommended.

'Unique ID' field setting

The 'Unique ID' field is a setting that prevents the same value from being used in multiple records for any specific field.
External IDs are often created with the 'Unique ID' setting so that the External IDs are unique to each record.


Example:
You could create a 5-character text field and set that field as a 'Unique ID'. If you enter '12345' as the value in this field, you would not be able to use '12345' as the value for that field in any other record. If you attempted to use '12345' again for another record, a message would appear stating that the value is already in use.

Note: If the 'Unique ID' field is not set duplicate records can be inserted using upsert. If the insertion happens at nearly the same time. This could be from different users, or async processes. This can result in DUPLICATE_EXTERNAL_ID errors for these records.

Example:

If it does not have Unique ID set on the field, allowing multiple copies of it to exist. The Async methods might have ending in a race condition, where records are created in parallel as they are not aware of each other. Async methods are then having DUPLICATE_EXTERNAL_ID errors thrown as there is multiple records present.This is due to the fundamental nature of Async processing. We do recommend to use Unique with External Id. While this could result in Duplicate Value errors being thrown at the time of insertion, it would be easier to catch and handle that then the DUPLICATE_EXTERNAL_ID later.

Knowledge-artikelnummer

000385174

 
Laddar
Salesforce Help | Article