Construct an email message with a template

Email templates provide a list of the fields from database tables that are available for constructing an email message.

There is also a template that allows a mailtoautomatic response link which allows the receiver of the email can to simply choose a link to send a pre-formatted response back to the instance. An example is the email template that is used for notification that an approval is required. The base email is shown below:

Figure 1. The email notification with the template specified

Notice the selection list on the right that shows the available fields from the sysapproval_approver table. All email templates get used based on an event that was created. Generally events are created based on Business Rules that execute when a database record is modified in some way. The database record being modified when the event is created is the record that is available for generating an email request.

In this case, a change request approval was being requested which results in an update to the sysapproval_approval table. The "approval events" Business Rule was executed which created the "approval. inserted" event. The "Approval Request" email event is defined to process the approval.inserted event and this email event is defined to use the change.itil.approve.role email template that is shown above. Notice that this template has two mailto: items specified. One for "mailto.approval" and one for "mailto.rejection." These are email templates that are used to construct an automatic response so that the email receiver can simply click a link in the email to automatically either approve or reject the change request.

Here is what the change.itil.approve.role template looks like using the rich HTML editor:

Figure 2. The change.itil.approve.role template

And the mailto.approval template:

Figure 3. The mailto approval template
Note: If you put text on the lines following the Click here to approve ${sysapproval} line, this forms the actual body of the email.

The above combination of templates would generate an email that looks something like the following:

Figure 4. Template generated email message

Notice that the receiver of this email has the following links in the mail:

  • A link to view all the details of the change request
  • A link to view the approval record
  • A link that will generate an automatic email response to approve the change
  • A link that will generate an automatic email response to reject the change