External lookup vs Indirect lookup
- johnsontitus
- May 14, 2020
- 1 min read
Updated: May 31, 2020
An External ID field is used to associate records instead of the usual record id.
The child record must have an existing lookup or master-detail relationship to the parent object.
The External ID is only necessary at the parent object.
External lookup relation is created when the external object is parent and standard, custom or external object is child.
External id field is on the parent external object that should match values of the external lookup relationship field on the child object.
Indirect lookup relation is created when external object is child and standard or custom object is parent.
External id field is on the parent standard or custom object.

Use case - To insert contacts obtained from external system. These contact records should be related to specific account records in Salesforce which also exists in external system.
But the external system does have information about record identifiers associated with account records in Salesforce.
The csv file contains contact records without the parent account IDs.
How to ensure that contact records are related to their parent account records after the import process.
Solution:
Define a Unique External ID field on the Account object in Salesforce and populate it with unique identifiers from the external system.
Also add this unique record identifier of the account records in the external system to the .csv file. Every contact record in the file should have a unique identifier.
In the contact object, create a custom lookup field which will store this identifier whilst importing the file.

Comments