Use the Relationships feature on the Gather Data page to pull fields from objects related to your base object into a template. For example, a quote solution built on Opportunity can also use fields from Account, Opportunity Product and Contact.

Gather Data page showing the relationship builder for a document solution

With relationships, you can:

  • Define and view the child and lookup objects related to the base object you selected in Document Setup.
  • Get accurate merge field syntax for those related objects automatically.
  • Use related object fields in your document templates.

Add a relationship

  1. Go to Document Setup, then Gather Data. The relationship layout starts with the base object of your solution, for example Opportunity.
  2. Add the related objects you need:
    • Click Add Child to include a related list object, for example Opportunity Products.
    • Click Add Lookup to include an object reached through a lookup field, for example Account through AccountId.
  3. Optionally, give each added object an alias and set a filter or sort order. The relationships appear as a map that shows the direction, object names and linking fields.

Get the merge syntax

After you set up the relationships, get the syntax for your template from either place:

  • The Available Merge Field button in each Add/Edit window:

    Available Merge Field button in the New Child Relationship window

  • Merge Field Helper, in the Upload Template window when you upload a template:

    Merge Field Helper button in the Upload Template window

    Open the Relationship Merge Fields tab to see the syntax for each related object by alias:

    Relationship Merge Fields tab listing the related objects by alias

Best practices

  • Use short, clear aliases for child objects, for example Con1 or OppPro.
  • Check your relationships before you design the template.
  • Test the template with the Merge Field Helper to confirm the fields are available.
  • Add only the relationships you need, to keep performance fast.

Related: Where do I find merge fields? · Use SOQL queries in Docs Made Easy