Skip to main content
Search Again

We think these articles could help you:

    See More
    Nintex Knowledge Base

    Obtaining Data Through a Junction Object Using SOQL

    Status: Validated

    How to use a SOQL relationship to obtain data through a Salesforce Junction Object. This is also known as replication through a lookup.

    1. Create a new relationship on your Document Package
    2. Change the "Type" to "SOQL"
    3. Give the relationship an alias. Be sure it is unique and that it does not match the naming convention of any existing objects or fields in your Salesforce Org.
    4. Paste the SOQL Query in the "SOQL" box
    5. The example below will pull in all Opportunity Contact Roles:

    Primary Object: Opportunity ( Opportunity )

    Related List Junction Object: Contact Roles (  OpportunityContactRole )

    Object In Junction Object: Contacts (  Contact )

    SELECT FROM OpportunityContactRole WHERE Opportunity.Id = '<<Opportunity_ID>>'

    SELECT lookup_(Object in Junction)api_name.field FROM junction_object_api_name WHERE = '<<main_object_record_id_tag>>'

    For custom objects, be sure to append __r at the end for dot notated fields.

    SELECT lookup_(Object in Junction)api_name__r.field FROM junction_object_api_name WHERE = '<<main_object_record_id_tag>>'

    • Was this article helpful?