How to find the merge field and childrelation names

This article provides instructions on how to find the merge fields and child relation names to be set in Office File Creator's template files.

 

Office File Creator uses Excel, Word, and PowerPoint files for templates, similar to Salesforce Classic's email templates {! Object API Name. Field API Name} format merge fields can be set in the template file.

 

How to Find Merge Field

Find from the Object Manager

The API name of an object or field name can be confirmed from the Object Manager's respective object screen. Click the setting icon in the upper right corner of the screen and click "Setup".

 

Select the target object from the Object Manager. Here we select Opportunity as an example.

 

Click on "Details" in the left sidebar. “Opportunity" displayed in the API detail name is the object API name.

 

Next, click on "Fields & Relations" in the left sidebar. A list of fields will be displayed. FIELD NAME are the API names.

 

For example, in the case of "TotalOpportunityQuantity", {!Opportunity.TotalOpportunityQuantity} would be the merge field.

 

 

How to find a child relationship name

A child relationship name is a relationship name (object name) used when referencing a child object from a parent object in a reference relationship. The child relationship name can be confirmed from "Fields & Relationships" screen of the Object Manager.

However, if the parent object's reference field is a custom field, the child relationship name will be the name with "__r" appended to the end of the child relationship name.

 

 

When the parent object's reference field is a standard field

As an example, the parent object is Opportunity and the child object is Opportunity Product. Open the Object Manager tab from the Setup. Enter "Opportunity" in the search box and click "Opportunity Product".

 

Click "Fields & Relationships", then click the parent object Opportunity.

 

"OpportunityLineItems" shown in the Child Relationship Name is the child relationship name. Therefore, the merge field of the OpportunityLineItems is {!OpportunityLineItems.Field API Name}. For example, in the case of Quantity of OpportunityLineItems, it will be {!OpportunityLineItems.Quantity}.

 

 

When the parent object's reference field is a custom field

As an example, the parent object is Parent__c, and the child object is Opportunity Product. Select "Parent," which is the parent reference field, from the "Fields and Relationships."

 

The Child's Relationship Name of Parent is "Parents." In this case, since the parent reference field is a custom field, Parents__r with "__r" at the end becomes the child relationship name. For example, in the case of the Quantity, the merge field would be {!Parents__r.Quantity}. The underscore of "__r" is a half-width underscore + a half-width underscore, which is two consecutive half-width underscores.

 

Package Object

From "Fields & Relationships" of the child object, select the parent's reference field.

 

For package objects, the child relationship name is the namespace prefix + "__" + child relation name + "__r".

In the example, the namespace prefix is "BillingMaster" and the child relationship name is "BM_BillDetail_Bills", so the child relationship name is "BillingMaster__ BM_BillDetail_Bills __r".

 

 

Copied title and URL