Saturday, March 28, 2015

External ID's in Salesforce

What is External ID?

When importing data into apps, you can use External IDs to prevent duplicate records from being created as a result of the import operation. It allows use of relationships defined in legacy systems when importing data into apps.


  • It is a flag that can be added to a custom field to indicate that it should be indexed and treated as an ID.
  • It is a user-defined cross-referenced field.
  • It can be created for custom field type (Text, Number or Email ONLY).
  • Each object can have up to 7 (seven) external Ids (as of Spring '15).
  • Configure UPSERT action to traverse object relationships defined in your app, but use External Id's from legacy system to discover record ID's.


  • It helps improve Report and API SOQL performance.
  • It can be used with UPSERT DML operation to seamlessly integrate apps with other systems.
  • No need to know record Id's to load data.
  • Very convenient for data integrations and migrations.

What is UPSERT?

UPSERT is an API function that combines INSERT and UPDATE into a single call. It uses an indexed custom field or External Id to determine whether to create a new object or update an existing object.
  • If the External Id is not matched, then a new object is created.
  • If the External Id is matched once, then the existing object is updated.
  • If the External Id is matched multiple times, then an error is reported.
  • Use UPSERT when importing data to prevent the creation of duplicates.

Useful Resources