Using External IDs as Foreign Keys


Using External IDs as Foreign Keys


You can use external ID fields as a foreign key, allowing you to bulk create, update, or upsert records in a single step instead of querying a record to get the ID first.

To do this, modify the column name of the Input table and add a period followed by the external ID field name. For example, this table uses bulk inserting of contact records:

ID LastName AccountID.SAPXID__c Error
  Emerson C01203  
  Harrison C01202  

In the first contact to be created (‘Emerson’), the relationship to the Account is specified using the SAP ID of C01203. Also, you must use the external ID value for all rows of the Input table.

You can use external IDs as foreign keys when bulk inserting, updating, or upserting.