Salesforce External Object Relationship – Indirect Lookup

In this article, we are going to see how to use Indirect lookup relationship using External objects in Salesforce. Before going into deep about indirect relationship, let us look at External objects at high level.

In this article, we are going to see how to use Indirect lookup relationship using External objects in Salesforce. Before going into deep about indirect relationship, let us look at External objects at high level.

External Object: 

If one needs to access data from external systems in Salesforce,  then we can make use of External object feature. It can be implemented based on three relationships mentioned below:

1. Lookup Relationship

2. External Lookup Relationship

3. Indirect Lookup Relationship

Lookup Relationship: 

It links a child Standard, Custom, or External object to a parent Standard or Custom object. It should be used only if there is a column that has Salesforce record Id.

External Lookup Relationship: 

It links a child Standard, Custom, or External object to a parent External object. Default External Id field on parent external object is matched against the external lookup relationship field. External Column Name will be used to map the child External lookup field.

Indirect Lookup Relationship: 

It links a child External object to a parent Standard or Custom object. External child object’s indirect lookup relationship field will be mapped to custom unique + external Id on parent object.

Now let us discuss in detail about indirect lookup relationship configuration with an example.

Below example shows an Order (External Child Object) associated with Account (Standard Salesforce Parent Object).

Before creating relationship with those two above objects, it is mandatory to create/specify the external data source and external object as shown in the screenshot below.

Go to Setup -> App Setup -> Develop -> External Data Source and create new data source as below and save it.

Once the external data source is saved, it will show ‘Validate and Sync’ button which allows you select the table which you want to include under external object.  In this example Orders and OrderDetails are selected.

salesforce external objects

Since in this indirect lookup relationship example, Order will be the child and hence we need to change the data type of Customer Id to indirect lookup as below. While changing data type to indirect lookup, it will require you to select ‘relate to’ object and ‘target field’. ‘Account’ is the “relate to” object and automatically created Customer Id on Account object is the target field.

salesforce external objects

Based on the customer Id specified on Account, it will display the associated external child Order object in its related list.

salesforce external objects

Standard Account object is the parent of external Order object. So it should be mapped to unique+external Id (Customer Id field). If there is no field, it will create one field with the specified data type when you relate Order object with Account object.

For this below Order object, customer Id is ‘3’ and it should be specified in the account’s customer Id. Finally,  it will display all the associated orders of account (based on customer Id).

external objects salesforce
external objects salesforce

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.