An external lookup relationship is used to link child Standard, Custom, or External objects to a parent External object. External IDs are used to map the external lookup relationship with Parent external object.
The steps to create an External Lookup Relationship:
1. Click Setup and navigate under Build > Develop > External Data Sources
2. Click the “New External Data Source” button to create a new data source.
3. Enter the name, API name, Type and Copy the URI from the below link and paste to URL Field and then Click “Save”
Sample data sources are available from http://services.odata.org/V3/Northwind/Northwind.svc/.
OData version supports v3 or later version. I chose Northwind (Read only). Then, it redirects to an XML page.
4. After saving the External Data Source, click the “Validate and Sync” button.
5. Choose the objects that you want to use from your external data source. Click the “Sync” button to synchronize the external data with your internal organization.
6. The Objects you selected as External Objects are now synced with your Salesforce organization and they are visible on their related list.
7. Now you can see the external Object API Name ends with “__x”, by clicking any one of the objects that are listed in the external objects related list (Refer above image).
Note: You can access the records only when a new tab is created for an external Object; otherwise, you can’t access the records of those External objects.
8. Here, we create a new external lookup relationship for opportunity, by Clicking “New” on Opportunity Fields and Relationship.
9. Select “External lookup relationship” datatype.
10. Choose the related object for which you want to create a lookup relationship.
11. Fill in the values for Field Name, Length, and Child Relationship Name fields, and grant the field level security (Visible/Read-Only) to profiles that need to access it.
12. After granting the field level permissions, Click “Next”
13. Select the page layout on which you want to display the external lookup relationship. By Default, it selects all page layouts.
14. Name the Related List Label that will be shown as a related list in Child Object.
15. Now, create a new Opportunity, and fill in all necessary field values. Choose the “Invoices Field”that has the external relationship on Opportunity. Now, click the “Save” button to save the record.
Pros and Cons:
External Objects and relationship are used to access data stored in an external system, but without physically storing them in Salesforce. External Lookup relationship on child object’s related list takes certain amount of time to load data since the data is retrieved from an external system. Lookup filter and Cascade delete are not available for external objects.