# Salesforce object relationships
Salesforce uses object relationships to associate data between two objects. These relationships use custom relationship fields and allow users to access related data directly from a record.
For example, the Account
and Contact
objects have a relationship where each contact stores a reference to one account, while each account can link to many contacts. This setup lets you view all contacts associated with an account directly from the account record.
Salesforce supports several types of object relationships, such as:
- Master-detail
- Lookup
- Hierarchical
Refer to the Salesforce documentation for more information on object relationships (opens new window).
# Related objects field
In Workato, all Salesforce triggers and SOQL search actions (opens new window) support the Related objects and Fields inputs. These inputs appear when you select Show optional fields and let you retrieve data from related objects, such as lookup relationships.
POLYMORPHIC RELATIONSHIPS
You must use the Relationships fields input to specify polymorphic relationships when configuring bulk actions. Refer to Salesforce's Relationship Fields in a Header Row (opens new window) guide for more information on polymorphic fields.
'Related objects' and 'Fields' inputs on triggers and actions
# Access fields in parent objects
The following example demonstrates how to trigger a recipe on new or updated Opportunity records and access fields from its related Account.
To do this, you will:
- Use the New/updated record trigger on the Opportunity object.
- Select fields from the related Account object to include in the trigger data.
Complete the following steps to configure the trigger and access the related Account fields:
Select Opportunity from the Object drop-down menu.
Open the Related objects drop-down menu and select Account to include fields from the parent object.
Only parent objects appear in the drop-down menu
Use the Fields input to select the required fields from both Opportunity and Account. Fields from related objects are listed with dot notation. For example, Account.Account ID
and Account.Deleted
.
Use the search bar to find fields quickly. If you leave this input field blank, the trigger retrieves only the fields from the Opportunity object.
Fields from Opportunity and its related Account object
To include fields like mailing address and business phone from Account, select them in the Fields input. These fields then appear in the datatree for use in subsequent recipe steps.
# Access fields in grandparent objects
GRANDPARENT RELATIONSHIPS
You must know the relationship field names in your Salesforce schema to access grandparent relationships.
Example of child-parent-grandparent relationship structure
In this example, Opportunities relate to Contacts or Accounts, and those objects relate to Users.
Complete the following steps to retrieve data from a grandparent object:
Toggle the Related objects field to enable text input.
Enter the relationship path using comma-separated values. For example:
Primary_Contact__r,Primary_Contact__r.User__r
- Use
__r
to denote a relationship. - For custom objects that end in
__c
, replace it with__r
. For example,Invoice__c
becomesInvoice__r
.
Ensure the relationship names are case-sensitive and match exactly. For example, Primary_contact__r
fails if the correct name is Primary_Contact__r
.
Select fields from both parent and grandparent objects in the Fields input.
Fields from parent and grandparent objects selected
Last updated: 6/18/2025, 7:13:12 PM