Use HTML Variable in Notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 05:31 PM
I want to use an HTML variable from a RITM to add to a notification.
I know I can edit html code within the notification creation form, and I have HTML formated text in a variable but from what I understand when I reference the variable in the notification ${variable_name}, its just going to pull in plain text.
How can I get formatted text from the RITM into the notifcation?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 08:09 PM
Hi @kshaw ,
notification pull the html variable and formats it
what you see in the html variable will be shown in notification as it is
if you want to format it further you can use notification email scripts and wrap the html field in the div container and add formatting to it
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 08:14 PM - edited 04-29-2025 08:22 PM
Hi @kshaw
You can acheive this using email script. This approach will work even of you store the HTML code in the string type field. PFB sample.
1. Catalog item with HTML variable/String variable
2. Mail script to process the HTML variable
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var html_txt = current.variables.html_variable;
template.print(html_txt);
})(current, template, email, email_action, event);
3. Use the mail script in the Notification
Output 1: (HTML type variable)
RITM:
Email:
Output 2: (Multiline text type variable)
Hope this helps,
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 09:17 PM
if you include the variable directly using the syntax ${variableName} it will respect the HTML format as shared by @Chaitanya ILCR
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader