How to add tags from a lookup relationship
With a lookup relationship in your DocGen Package, you have access to all the data on the lookup object. So, for example, let's say you have a lookup to the name of an account on your Opportunity object. In your document, you want to add the name of this account, but also want to add the mailing address and the phone number. You can access all the data on the record for the account, but you first have to add lookup relationship to your DocGen Package, and then select the Contact Id in the field tagger. This gives you access to a new field, Lookup Object Field, only available for lookups. Use Lookup Object Field to select any field on the account record, including mailing address and phone number.
Retrieve tags from a lookup object
First create a lookup relationship, then tag your template.
Create the Salesforce Object lookup relationship
The first step to retrieving information from a lookup record is to establish a Salesforce Object lookup relationship between both objects. In our example, the lookup is from the Opportunity object to the Account object. Although the field on our Opportunity record might only include the name of the account, our DocGen Package will have access to all the data on the Account record, including mailing addresses and phone numbers.
To create a Salesforce Object lookup relationship
-
For step-by-step instruction on creating a Salesforce Object lookup relationship, see Salesforce Object relationships.
Tag the template
In the Field Tagger, find the field with a greater than sign (>) next to an Id field related to the lookup object. Make sure that you have the starting object for your DocGen Package selected as the Main Object. In our example, we created a lookup to Accounts from a DocGen Package based on the Opportunity object, so we would select Opportunity as the Main Object and Account ID (Id) > as the Field.
Why select Opportunity as the Main Object if the information you want is on the Account object? You want the information from the lookup, but it has to come through the starting object to make the information relevant to your documents.
To tag your template for a lookup
-
From a DocGen Package on DocGen Packages, click Field Tagger.
-
Select the staring object for your DocGen Package as the Main Object.
In our example, this would be the Opportunity object.
-
In Field, select the Id for the lookup field that has great than sign (>) next to it. This indicates that it's an Id field for a Salesforce Object lookup relationship included in the DocGen Package. The Lookup Object Field appears and all the available Filed Tags switch to those fields available from the lookup object.
So the tags in our example change from their original format (MainObject_FieldName format to LookupObject_FieldName format). And now you have access to all the fields on the lookup record.
-
In Lookup Object Field, copy the field tag into your template.
Tip: You can't use Lookup Data to retrieve sample data with a Lookup relationship (Id) > selected in Field.
For more information about using Field Tagger, see Field Tagger.