Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Email Notifications
Overview
Use email notifications to send selected users email about specific activities in the system, such as updates to
incidents or change requests. If you want to change how the system processes incoming email, see Inbound Email
Actions.
Email notifications allow administrators to specify:
When to send the notification
Who receives the notification
What content is in the notification
Additional email notification options are available. Users can subscribe to notifications, and administrators can make
some notifications mandatory. See Notifications for all the tasks required to create and send custom email when
system events occur.
Administrators also have the option of converting existing email notifications to a rich HTML format (starting with
the Eureka release). This format provides several advantages, including :
Raw HTML content is converted into a WYSIWYG format.
The content can be edited in a feature-rich HTML editor.
Mail scripts are condensed into a single, easy-to-read line that can be reused in multiple email notifications.
To prevent broken links, items like images and incidents, that are linked with URLs relative to a particular
instance are converted to absolute links. For example, if an incident is linked using a relative URL, the link is
converted to an absolute link.
Note: The rich HTML format is the default for all new email notifications starting with the Eureka release.
Field Description
Name Enter a unique name for the email notification. Descriptive names help identify the purpose of the email notification. For example,
Incident Opened & Unassigned.
Table Select the database table to which this notification is linked, such as Incident [incident].
Warning: Do not select the Task [task] table. This table is for extending other tables. Notifications that run on the
Task table directly are not supported.
Note: The list shows only tables and database views that are in the same scope as the email notification (starting with
the Fuji release).
Type Select the type of notification you are creating: EMAIL or Meeting Invitation.
Note: If multiple notifications are generated by the same trigger, the system only sends on notification. The system considers all other
notifications, even those with a different subject and body, as duplicates. This functionality is controlled by the Ignore Duplicates
business rule.
When creating a notification based on a new or updated record, specify what additional conditions must be met to
trigger the notification. You can specify these notification-specific conditions.
Changes: Checks to a see if a field value changes.
Changes from: Checks to see if a field value changes from a particular value.
Changes to: Checks to see if a field changes to a particular value.
Use these steps to specify when to send a notification.
1. Identify the notification.
2. Fill in the fields for the When to send section of the Email
Incident notification sent on insert or update
Notifications form (see table).
Field Description
Send when Select under what condition the notification is sent: when a record is inserted or updated or when a particular event is triggered.
Weight [Required] Set a numerical value for this notification's priority relative to other notifications with the same target table and recipients.
The system only sends the notification with the highest weight. All other notifications are moved from the Outbox to the Skipped
mailbox. The default value 0 causes the system to always send the notification (assuming the conditions are met).
For example, suppose a service desk agent adds a comment to an incident and shortly thereafter closes it. By default, these actions
trigger both the Incident commented and Incident Closed notifications. However, since both notifications are from the Incident table
and both notify the incident caller, the system only sends the notification with the highest weight, in this case the Incident Closed
notification.
Notification weights
Note: The SMTP Sender scheduled job determines how often to send email. By default, this job runs every minute.
Conditions Use the condition builder to select the conditions under which this notification is sent. For example, you might select Priority >
greater than > 3 - Moderate to send the notification only for High and Critical priority incidents.
Inserted Select the check box to enable email notification when a record is inserted. This field is visible only when the Send when field has
been set to Record inserted or updated.
Email Notifications 4
Updated Select the check box to enable email notification when a record is updated. This field is visible only when the Send when field has
been set to Record inserted or updated.
Event Select the event that triggers this notification. This field is visible only when the Send when field has been set to Event is fired.
name
You can add a script-based condition in the Advanced condition field by configuring the Email Notification form
and adding the field. You can access the field in the Advanced view without configuring the form starting with the
Eureka release.
The advanced condition script uses the following global variables:
current: contains the current record from the table to which the notification is linked.
event: contains the event that triggered the notification.
Note: The Advanced condition field is evaluated in addition to other conditions you set on the notification. Both the Condition and
Advanced condition must evaluate to true in order to send the notification.
Email Notifications 5
Field Description
Users/groups in Select users or groups from reference fields and Glide lists of the notification record's table. For example, if a notification uses the
fields Incident [incident] table, then you can select users or groups from incident fields like Opened by and Assignment group. This
list of users or groups is variable and depends upon the values of the associated task record.
Note: You can dot-walk to values in reference fields by clicking the plus sign in the field selector and then selecting the related
field.
Users Select the users you want to receive the email notification. You can search for users with the reference lookup icon or manually
add their email addresses. This list of users is static.
Groups Select the groups you want to receive the email notification. You can search for groups with the reference lookup icon or by
manually entering the group name. This list of groups is static.
Note: As a best practice, use the same format type for all notifications. This ensures that all notifications have a consistent look and
feel.
Although there are no required content elements, you can use one or more of the following options to specify the
email notification contents:
Attach documents from source records
Customize the watermark
Format the email body using an email template
Add and edit HTML markup
Add images
Specify alternative outbound email addresses
Note: Additional fields are available in Advanced view; however, these are needed only under rare circumstances.
Email Notifications 7
Fill in these fields to specify the content of an email notification (starting with the Eureka release).
Field Description
Email If you want to re-use existing content, select an email template to add content to the email notification.
template
Subject Enter the subject line for the email message. The subject can include variables from the Select variables column.
Message Enter the content of the email notification message. The message can include variables from the Select variables column. Variables
HTML map to column names available from the notification table, its parent tables, and reference tables. Use variables to include values from
a record in the table such as an incident's short description or comments and work notes. The Message HTML field is visible only if
you set the content type to HTML and plain text or HTML only.
Note: If you want to include a link to the record that triggered the notification, see Enabling Links to ServiceNow Records.
SMS Enter the notification message to send to an SMS device. The SMS alternate message is limited to 140 characters.
alternate
Enter values for the following fields on the legacy Email Notification form.
Email Notifications 8
Field Description
Email If you want to re-use existing content, select an email template to add content to the email notification.
template
Subject Enter the subject line for the email message. The subject can include variables from the Select variables column.
Message Enter the content of the email message. The message can include variables from the Select variables column as well as HTML code
if you set the content type to HTML and plain text. Variables map to column names available from the notification table, its parent
tables, and reference tables. Use variables to include values from a record in the table such as an incident's short description or
comments and work notes. Notes:
You cannot use HTML code to control the appearance of the contents of the ${comments} variable.
If you want to include a link to the record that triggered the notification, see Enabling Links to ServiceNow Records (Deep
Linking).
SMS Enter the notification message to send to an SMS device. The SMS alternate message is limited is 140 characters.
alternate
Note: The letter "P" at the bottom of the screen shows the location of your cursor within the Message field. In this case, the cursor is
in a line containing an HTML <p> tag.
Note: For email notifications that were created in the Eureka release or that were already converted, the Switch to Rich HTML
Editor button is not displayed.
Email Notifications 10
In many cases, an unconverted mail script fails to run from inside the HTML editor. If you select Yes, the script is
added to the Email Script [sys_script_email] table and is automatically replaced in the body with an embedded script
tag.
You can view the mail scripts in their original form by opening the email notification and clicking the Show
Notification Scripts related link.
Selecting the Newlines to HTML check box indicates that the method for handling line breaks in earlier versions
carries forward for email notifications and templates used in Eureka. When an email notification or template is
converted to rich HTML, the Newlines to HTML check box is automatically selected.
For new mail scripts written in Eureka, it is a best practice to add correct HTML line breaks to
template.print() statements.
If an email notification or template to rich HTML is not converted to rich HTML, newlines are automatically
wrapped with <div> tags, the same as versions prior to Eureka. The old mail scripts still work; however, the
administrator does not enjoy the benefits of working in the rich HTML format, and does not have as much control
over exact HTML formatting.
Best Practice
When writing new scripts, it is best to insert explicit HTML line breaks and clear the Newlines to HTML check box
so that no HTML tags are injected when email notifications are generated. The same approach is recommended for
existing notifications and templates. That is, a best practice would be to replace template.print("\n")
JavaScript function calls with template.print("<br />"). This gives you better control over the HTML
formatting of your email notifications.
Adding HTML Markup When the email format is multipart/mixed, you can add HTML markup to the body of the message. For example, this
HTML markup:
Linking to an Attachment
You can add attachments to a notification by linking to the attachment record in the message of the notification.
Linking to attachment records in this fashion requires using email notification scripting. For example:
template.print('Attachment: <a href="/sys_attachment.do?sys_id=' + gr.sys_id + '">' + gr.file_name + '</a>\n');
${report:X:Y}
where:
X is the type of report you want to attach (reportID, gaugeID, dashboardID, or chartID).
Y is the sys ID of the report, gauge, dashboard, or chart to be attached.
For example:
${report:reportID:<abc123>}
${report:gaugeID:<abc123>}
${report:dashboardID:<abc123>}
${report:chartID:<abc123>}
Email Notifications 14
${URI+&sysparm_scriptlet=current.assigned_to=gs.getUserID()
&sysparm_scriptlet_condition=current.assigned_to.nil()
&sysparm_view=incident_active}
current.assigned_to=gs.getUserID()
current.assigned_to.nil()
Related Record to Provide Link to Notification record table Reference Field Samples
Related task record to be approved from an approval Approval Approval for ${sysapproval.URI}
notification [sysapproval_approver] [sysapproval] ${sysapproval.URI_REF}
For example, the following notification template produces the email links in the picture below:
${CMS_URI+<site>/<page>}
For example, to link the email recipient to a page called Incident in the content site ESS, with the current incident as
the target document, use the following format:
${CMS_URI+ess/incident_detail}
The resulting email URL has this format:
https://<instance
name>.service-now.com/ess/incident_detail.do?sysparm_document_key=incident,46e18c0fa9
Note:
Create a custom watermark prefix for each instance to prevent accidentally triggering events in the wrong instance.
Do not use colons (:) in custom watermark prefixes. Colons are a reserved character and may cause the watermark to be ignored.
Email clients that use the plain text version of the email still show the watermark.
Email Notifications 16
4. Click Update.
Email Notifications 17
Send to event Select this check box to send the notification to the person who performed the action that started the notification process if the
creator person is also specified in the Users/groups in fields, Users, or Groups field. If the event creator is not specified in one of
these fields, the event creator does not receive a notification regardless of the setting in this field.
[2]
For troubleshooting information, see Troubleshooting email notifications - Send to the Event Creator on the ServiceNow
Community.
Event parm 1 Select this check box if the event parameter 1 contains one or more email recipients (in a comma separated list). This field is
contains recipient visible only when the Send when field is set to Event is fired.
Event parm 2 Select this check box if the event parameter 2 contains one or more email recipients (in a comma separated list). This field is
contains recipient visible only when the Send when field is set to Event is fired.
Subscribable Select this check box to allow users to subscribe to this notification.
Warning: Do not select this check box for any other type of notification. See Subscribable Notifications
for details.
Content type Select the content type for the email notification:
HTML and plain text
HTML only
Plain text only
By default, HTML only is enabled.
Include Select this check box to send all attachments from the triggering record as email attachments.
attachments
Omit watermark Use this check box to apply or remove the watermark attached to each email. ServiceNow does not recommend removing the
watermark as a reply to an email without a watermark creates a new incident rather than updating the incident the original email
referred to. For more information, and an alternative way to hide watermarks, see Watermarks.
Email Notifications 19
Message Text Enter the notification message to send in plain text. This field is visible only if you set the content type to HTML and plain
text or Plain text only.
From Enter the email address you want the email notification to use in the From field. For example, helpdesk@yourcompany.com.
Reply to Enter the email address you want people to use when replying to the email notification. For example,
helpdesk@yourcompany.com.
[3]
Warning: Before you activate the Engine Based Notifications plugin, see KB0540612 to prevent the loss of customizations.
If you have the admin role, use the following steps to activate the plugin.
1. Navigate to System Definition > Plugins.
2. Right-click the plugin name on the list and select Activate/Upgrade.
If the plugin depends on other plugins, these plugins are listed along with their activation status.
3. [Optional] If available, select the Load demo data check box.
Some plugins include demo datasample records that are designed to illustrate plugin features for common use cases. Loading demo data is
a good policy when you first activate the plugin on a development or test instance. You can load demo data after the plugin is activated by
repeating this process and selecting the check box.
4. Click Activate.
References
[1] https:/ / hi. service-now. com/ kb_view. do?sysparm_article=KB0535129
[2] https:/ / community. servicenow. com/ community/ service-management/ incident/ blog/ 2015/ 02/ 04/ beware-beware-the-event-creator
[3] https:/ / hi. service-now. com/ kb_view. do?sysparm_article& #61;KB0540612
Article Sources and Contributors 20