Associating Salesforce Junction Objects: A Guide
Salesforce allows you to configure either a one-to-many or many-to-many relationship between objects through junction objects. The specific configuration you choose depends on your desired outcome and how you plan to sync data between the related objects.
For this example, we will use Opportunity Contact Role as the junction object that connects Opportunities and Contacts. These same principles apply to any junction object relationship.
One-to-Many for Opportunities and Contact Roles
This configuration establishes that:
- Opportunity records and their associated activities can be assigned to only a single person in Ortto.
- A person can be associated with many Opportunities (one-to-many relationship).
- The person is linked to an Opportunity through the Opportunity Contact Role, which acts as the junction object, using the Primary Contact Role.
Steps to Configure:
- Select Opportunity and Opportunity Contact Role objects.
- In the Opportunity object, edit identifiers as follows:
- Identify object by: Relationship via junction object (many-to-many)
- Junction object: Opportunity Contact Role
- Opportunity reference field: Opportunity ID
- Associate with Ortto object: Contact
- Reference ID field: Contact ID
- In the Opportunity Contact Role object, edit identifiers as follows:
- Identify object by: Reference ID
- Associate with Ortto object: Contact
- Reference ID field: Contact ID
- Ensure that the following filter is added to your Selective sync settings:
- Primary filter: Opportunity Contact Role: Primary
One-to-Many for Opportunities, Many-to-Many for Opportunity Contact Roles
A limitation with the one-to-many configuration (Option 1) is that it does not allow for syncing updated activities related to Opportunity Contact Roles. This happens because:
- Activities related to Opportunities and Opportunity Contact Roles are tied to the Primary Contact Role.
- If a Salesforce record is removed as the primary contact for an Opportunity, the associated activities (including Opportunity Contact Role activities) are no longer linked to that person’s record in Ortto.
To allow activities for Opportunity Contact Roles, follow these steps:
- Select Opportunity and Opportunity Contact Role objects.
- In the Opportunity object, set the following identifiers:
- Identify object by: Reference ID
- Associate with Ortto object: Contact
- Reference ID field: Contact ID
- In the Opportunity Contact Role object, set the following identifiers:
- Identify object by: Reference ID
- Associate with Ortto object: Contact
- Reference ID field: Contact ID
- Remove the Opportunity Contact Role: Primary filter from the Selective sync settings.
Many-to-Many for Opportunities
By default, Ortto uses a one-to-many configuration for Opportunities, tracking activities only for the Primary Contact Role through the Opportunity Contact Role junction object. However, if you want all records associated with an Opportunity to receive activities tied to that Opportunity, you can configure a many-to-many relationship.
Steps to Configure:
- Select Opportunity and Opportunity Contact Role objects.
- In the Opportunity object, set the following identifiers:
- Identify object by: Relationship via junction object (many-to-many)
- Junction object: Opportunity Contact Role
- Opportunity reference field: Opportunity ID
- Associate with Ortto object: Contact
- Reference ID field: Contact ID
- In the Opportunity Contact Role object, set the following identifiers:
- Identify object by: Reference ID
- Associate with Ortto object: Contact
- Reference ID field: Contact ID
- Remove the Opportunity Contact Role: Primary filter from the Selective sync settings.
This insight from Ortto provides the necessary configurations for different relationships between Opportunities and Contact Roles using junction objects in Salesforce. The settings can be adjusted based on your specific data synchronization needs.