Generate Notification Body Using a Template with Placeholders
Table of Contents
Use Case
You might want to generate the e-mail body using a template with placeholders for variable data, for example, to notify the users about work results or deadline changes.
In this article, we will generate the notification text sent to employees during the vacation request approval process.
Prerequisites
To proceed with the example, create the attributes as shown in the table below:
Record template name | Attribute name | Attribute system name | Attribute type |
Vacation Requests |
Notification template | messageTemplate | Text |
Employee's full name | employeefullname | Text | |
Signing date | signingDate | Date & time | |
HR's full name | HRfullname | Text | |
Notification body | notificationbody | Text |
Instructions
- In the Vacation Requests template, place the Notification template, Employee's full name, Signing date, HR's full name, and Notification body attributes on the form.
- In the Notification body attribute properties, check the Auto calculate box.
- In the Calculated value, enter the following formula:
FORMAT($messageTemplate, LIST($employeefullname, $signingDate, $HRfullname))
Note
Instead of calculating the attribute value, you can populate the message template using form rules or scenarios.
- Create a record in the Vacation Requests template and fill in the Notification template field with the following text
Good day,
{0}
!
Please come to the HR Director's office on{1}
to sign the vacation leave paperwork.
Sincerely, Human Resources Specialist{2}
Here the numbers in curly brackets
{0}
denote the placeholders to substitute with the Employee's full name, Signing date, and HR's full name. - Fill in the Employee's full name, Signing date, and HR's full name on the form.
- The Notification body field should now contain the message body filled with the data you filled in.
- Use the resulting Notification body attribute value in the notification messages.
Formula Syntax
Element | Description |
---|---|
FORMAT(originalText, replacerTextList) |
The
The |
LIST(argument1, ..., argumentN) |
The |
$ |
The |