When creating an email template, you can format merge fields to control how the information is displayed to the recipient e.g. whether the date is shown as 31 Mar 23, or 31 March 2023.
For information on how to add merge fields to Email Templates refer to Including Merge Fields in Email Templates and Signatures.
Numerical Merge Fields
You can format numerical email merge fields, for example for currency amounts, so the result includes commas and brackets for negative amounts. Refer also to Formatting at the bottom of the Email Editor Groups in Including Merge Fields in Email Templates and Signatures.
The following formatting codes can be added when the "Merge Field" is added to the Email template. The example shows the formatting result on a number -1000123.00
- {{ "Merge Field" | comma_group }} to format as -1,000,123.00
- {{ "Merge Field" | dot_group }} to format as -1.000.123,00
- {{ "Merge Field" | blank_group }} to format as -1 000 123.00
- {{ "Merge Field" | negative_parens }} to format as (1000123.00)
- {{ "Merge Field" | negative_squares }} to format as [1000123.00]
Filters can be chained, but the grouping filter needs to go before the negative filter in the list, for example:
{{ "Merge Field" | comma_group | negative_parens }} to format as (1,000,123.00)
When adding the formatters, the pipe character ( | ) is added by typing the Shift + Backslash (\) key. Ensure that the spaces are added correctly as in the examples.
For example, to display the results of the Merge field for the Tax Payable/Tax Refundable amount with a dollar sign at the start and a comma for the thousands, add this as follows:
${{ Tax_PayableRefundable | comma_group }}
Date Merge Fields
By default, custom date fields are formatted as dd-mmm-yyyy e.g. 31 Mar 2023. This can be formatted to change the date appearance by adding a formatting instruction following the merge field.
The following formatting codes can be added to the merge fields when added to an email template. The codes show the results when formatting the date of 31st March 2023.
- {{ Merge field }} (i.e. no formatting instruction) to format to 31 Mar 2023.
- {{ "Merge Field" | date: "%d %B %y"}} to format to 31 March 23.
- {{ "Merge Field" | date: "%d %B %Y"}} to format to 31 March 2023.
When adding the formatters, the pipe character ( | ) is added by typing the Shift + Backslash (\) key. Ensure that the spaces are added correctly as in the examples.
For example, to include the custom merge field "Job Start Date" from Xero Practice Manager, with the full month and year displayed, the following merge field would be added to the email template:
{{ XPM_custom_Job_Start_Date | date: "%d %B %Y" }}