Merge fields
A merge field lets you use a field name to incorporate a value from a record in Sage People. For example, the system uses the merge field fHCM2__Hire_Date__c from a team member record in a PDF Template. This produces the team member's hire date in the PDF document.
Merge fields in formulas
Merge fields in formulas use the API name of the field with no surrounding symbols:
Merge fields outside formulas
Merge fields you use outside formulas require other syntax:
Merge fields within an object
You can use a merge field to reference a field in the same object. Then you can use full Salesforce syntax with the object API name as a prefix to the field API name:
Or you can leave out the object API name and just use the field API name:
Merge fields across objects
Merge fields can work across objects. This lets you generate a document like an email or PDF file from one object. It references a field or fields in another object or objects.
Cross-object referencing uses an extension of Salesforce syntax to enhance the range of merge fields you can reference.
Follow these rules:
-
The merge field must start from the current object. For example, if you're sending a document from Team Member. The first reference must be to a field in Team Member
-
Objects contain Lookup fields to provide links to other objects. For example, Team Member includes the following lookup fields:
Field API Name Links to Current Competency Assessment fHCM2__Current_Competency_Assessment__c The most recent, complete, competency assessment for the Team Member. Current Employment fHCM2__Current_Employment__c The most recent Employment Record for the Team Member. Current Job Description fHCM2__Current_Job_Description__c The most recent, complete, job description for the Team Member. Current Performance Review fHCM2__Current_Performance_Review__c The most recent, complete, performance review for the Team Member. Current Talent Plan fHCM2__Current_Talent_Plan__c The most recent, complete, talent plan for the Team Member. Department fHCM2__Department__c The Team Member's HR Department. Job Profile fHCM2__Job_Profile__c The Team Member's job profile. Policy fHCM2__Policy__c The policy you assigned to the Team Member. Use the Lookup fields in the current object when building merge field references across objects.
For more examples, see Selected reference fields.
Tests cross-object merge fields carefully in your email templates. Cross-object fields work in emails the system triggers with action events, but not in emails that Salesforce Flows send. If you need a cross-object merge field in an email template for a Flow, create a formula field on the object where the email triggers. For more information about formula fields, see Formulas | Create a formula field.
Dates in merge fields
By default, dates in merge fields display using the locale settings you defined for your org. If you want to display dates in a different format, you can include date formatting in the merge field. For example:
-
To display the month of the employment start date as a three letter abbreviation:
Copy{!dateformat(fHCM2__Employment__c.fHCM2__Start_Date_c, 'dd MMM yyyy')} -
To display the full month name of the employment start date at the start of the date format:
Copy{!dateformat(fHCM2__Employment__c.fHCM2__Start_Date_c, 'MMMM dd, yyyy')} -
To display the three letter abbreviation of the weekday name for an absence start date:
Copy{!dateformat(fHCM2__Absence__c.fHCM2__Start_Date_c, 'EEE dd MMMM yyyy')}
Some date fields don't allow you to apply date formatting when you use them as merge fields:
-
Interview date on the Application object
fRecruit__Application__c.fRecruit__Interview_Date__c
When you don't apply date formatting, these fields display dates correctly when you use them as merge fields. If you're attempting to apply date formatting to one of these fields:
-
Create a custom formula field with the formula return type Text.
Use the Advanced Formula editor to enter the formula.
-
Add the formula field as the merge field.
Sage People stores Date/Time fields in GMT using the format yyyy-mm-ddThh:mm:ss.000Z, for example: 2023-11-03T18:20:54.000Z.
When applying a formula to a text field holding a Date/Time, you can extract the parts of the date and time you need to display. Add the text string GMT to make the timezone clear.
For example:
MID(TEXT( End_Date__c ), 9, 2)&"-"& MID(TEXT( End_Date__c ), 6, 3)&"-"&LEFT( TEXT( End_Date__c ) , 4)&" GMT"
displays 2023-11-03T18:20:54.000Z as 03-11-2023 GMT
Number and currency in merge fields
For formatting number or currency fields, review the options you used in the settings of the field itself. The field settings let you set the number of decimal places. For example:
No equivalent option to dateformat exists for number or currency fields when you use them as merge fields. You can merge fields to format number or currency fields differently from their format elsewhere. Consider creating a formula field with the format you want. Then use it as the merge field.
BLANKVALUE() and adding substitute text
When you use the BLANKVALUE() function with a merge field, you can add substitute text to a merge field. Substitute text displays in the document you generated if the merge record doesn't contain data in that field. For example:
Please attend your Back to Work interview on {!BLANKVALUE(fHCM2__Absence__c.fHCM2__Back_To_Work_Interview_Date__c, the date to be advised by your HR Contact)}.
This merge field displays the Back To Work Interview Date when you set it. It shows the substitute text "...the date to be advised by your HR Contact" when you don't set it.
In email templates, you can omit the BLANKVALUE() function. However, you must include it in PDF templates for substitute text to work correctly.