Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Construct an email message with a template

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.

An email template can include a mailto automatic response link, which enables the email recipient to simply choose a link that sends a preformatted response back to the instance. An example is the email template used for notification that an approval is required. The following example shows the base email:

Figure 1. Email notification with the template specified
The Approval Request notification uses the change.itil.approve.role email template.

The selection list on the right shows the available fields from the sysapproval_approver table. All email templates used are 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 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 following change.itil.approve.role email template. Notice that this template has two mailto: items specified. One for "mailto.approval" and one for "mailto.rejection." This email template builds an automatic response that lets the email receiver simply click a link in the email to 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. change.itil.approve.role template
The change.itil.approve.role template specifies the HTML message contents in the approval request email.

Notice the change.itil.approve.role template also uses a predefined email layout (Unsubscribe and Preferences), which provides links for the recipient to unsubscribe from approval notifications and set notification preferences.

And here is the mailto.approval template:

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

The combination of templates used would generate an email similar to the following example:

Figure 4. Template generated email message
The example generated email contains the content determined by the change.itil.approve.role template.

Notice that the email recipient can use 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 generates an automatic email response to approve the change
  • A link that generates an automatic email response to reject the change
  • A link to unsubscribe from approval notifications and another link to set notification preferences