Notification variables
Summarize
Summary of Notification variables
Notification variables in ServiceNow enable you to include dynamic content in notification bodies, such as field values, record links, images, and system preference links. Using these variables enhances the relevance and personalization of notifications sent to users.
Show less
Key Features
- Syntax: Variables use the format
${variable-name+variable-parameters}, where the variable name is required and parameters are optional depending on the variable. - Field Values: Use
${field-name}to display specific field values directly in notifications. - Record Links: Variables like
${URI}and${URIREF}generate clickable links to records;${URI}uses "LINK" as link text, while${URIREF}uses the record's display value. - Reference Field Links: Link to records referenced by fields using
${reference-field.URI}or${reference-field.URIREF}with similar link text behavior as above. - Images: Display images associated with records using
${image-field-name}, especially useful within HTML email templates. - CMS Page Links: Use
${CMSURI+to link to specific CMS pages./ } - Email Content and Scripts:
${notification:body}inserts the body of an email template or notification, and${mailscript: script-name}runs a mail script within the notification. - Unsubscribe and Preferences Links:
${NOTIFUNSUB}and${NOTIFPREFS}insert links for users to unsubscribe or manage notification preferences. - Comments and Work Notes: Variables like
${comments:n}and${commentsandworknotes:n}display recent comments or combined comments and work notes on the target record, wherenspecifies how many entries to show.
Important Considerations
- Some variables do not support parameters, and not all variables apply in every context (for example,
${URI}and${URIREF}do not apply to records in Workspace). - To link to records in Workspace, use mail scripts to generate URLs.
Practical Use
By integrating these variables into notification templates, ServiceNow customers can create highly dynamic and informative notifications that provide recipients with direct access to relevant records, contextual information, and actionable links, improving communication efficiency and user experience.
Use notification variables to display dynamic information in the body of a notification such as a field value, a link to a record, or a link to system preferences.
Syntax
Specify a notification variable using this syntax:
${variable-name+variable-parameters}
The variable-name portion is always required. Not all notification variables support the variable-parameters portion. When available, most variable parameters are optional. See the list of available notification variables for variable names and available parameters.
Available variables
The system provides these notification variables.
| Variable | Description | Available parameters |
|---|---|---|
| ${field-name} | Display the value of the specified field. | None |
| ${image-field-name} | Display an image associated with a record. This variable is typically used with HTML to specify the source of an image element. | None |
|
Display a link to the current record.
Note: These variables don't apply to records in Workspace. To link to a
record in Workspace, create a mail script that prints a URL to a
notification. For more information, see Linking to a record in Workspace. |
Any valid sysparm URL parameter. For example:
|
|
Display a link to the record listed in a reference field.
|
Any valid sysparm URL parameter. For example:
|
| ${CMS_URI} | Display a link to the specified record within a CMS page. | <CMS-site>/<CMS-page>: The required relative path to the CMS page. |
| ${notification:body} | Display the body contents of an email template or email notification. Use this notification variable to specify where to display body content in an email layout. | None |
| ${mail_script:script-name} | Run the specified mail script. | None |
| ${NOTIF_UNSUB} | Display a link unsubscribe from this notification. | link_text: specify the text to display as a link within quotation marks. |
| ${NOTIF_PREFS} | Display a link to set notification preferences. | link_text: specify the text to display as a link within quotation marks. |
| ${comments:n} | Display the most recent comments that were made on the target record. The number of
comments to display is n. For example, To display all comments, use the variable |
Any number greater than 0. |
| ${comments_and_work_notes:n} | Display the most recent comments and work notes that were made on the target record. The
number of comments and work notes to display is n. For example,
To display all comments and work notes, use the variable
|
Any number greater than 0. |
Examples
| Variable | Example |
|---|---|
| ${field-name} | Source: Output: Incident INC1000001 - comments added |
| ${image-field-name} | Source: Output: |
|
${URI} Source: ${URI} Output: ${URI_REF} Source: ${URI_REF} Output: |
|
Source:
Output: |
| ${CMS_URI} | Source: Output: a link to a target CMS page such as |
| ${notification:body} | Source: Output: |
| ${mail_script:script-name} | |
| ${NOTIF_UNSUB} | |
| ${NOTIF_PREFS} |