PDF Templates | Using formulas and merge fields

Documents based on PDF templates can be customized using formulas and merge fields.

For more information see: 

When you include merge fields in the PDF template, always include the reference to the object, even if the merge field included is on the same object from where the PDF is being sent. For example, if a PDF is sent from the Employment record, which includes the Work Location field, the merge field is {!fHCM2__Employment__c.fHCM2__Work_Location__c}.

You can include merge fields from related objects. For example, if you send the PDF from the Employment Record, you can include merge fields such as the team member's first name from the Team Member object: {!fHCM2__Employment__c.fHCM2__Team_Member__r.fHCM2__First_Name__c}.

Tip

If you include the team member's address fields as merge fields in a PDF template, Sage People recommends inserting each address field into its own section in the PDF template. Sections with blank merge field values are automatically excluded from the PDF, and you avoid having empty lines in the address details.

How can I make a formula work across objects?

  • Starting from the object hosting the formula, build a chained field reference to the field you want to use.
  • Use the API Names of the objects and fields.
  • Replace the terminating __c in the object API Names with an __r

For example: 

  • To use the Current Salary Amount in a formula hosted on the Team Member object:

    fHCM2__Current_Employment__r.fHCM2__CurrentSalary__r.fHCM2__Amount__c

Handling potentially blank date fields

A blank date field used as a merge field in a PDF template section can cause the section in which it is used to be omitted from the generated PDF.

You can use conditional sections to handle the potentially blank date value: have one section to display if the date value is not blank, and another section to display if it is blank. The Verification of Employment PDF template included in Sage People implementations as standard contains examples to illustrate this.