- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 09:40 PM
Hi,
I have this notification setup for some table.
Here the requirement is to show Priority choices in different colors in the notification like if record has High priority it should be in "red" in the notification ; if Medium then "orange" color in notification and so on for other choices. How to achieve this? Any inputs here?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 10:57 PM
Hi @Appu2
You need to write mail script to assign the color :
Step 1 : Create mail script
Name : priority_color
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
/* Get priority */
var getPriority = current.getValue('priority');
var priority;
if (getPriority == 1) {
priority = '<span style="color:red;"> Critical </span>';
} else if (getPriority == 2){
priority = '<span style="color:orange;"> High </span>';
} // and so on
template.print(priority);
})(current, template, email, email_action, event);
Step 2 : Call that mail script in Notification
Output :
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 10:12 PM
Use if condition and check for priority.
Then add style for color.
Please mark my answer as helpful and solution accepted.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 10:57 PM
Hi @Appu2
You need to write mail script to assign the color :
Step 1 : Create mail script
Name : priority_color
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
/* Get priority */
var getPriority = current.getValue('priority');
var priority;
if (getPriority == 1) {
priority = '<span style="color:red;"> Critical </span>';
} else if (getPriority == 2){
priority = '<span style="color:orange;"> High </span>';
} // and so on
template.print(priority);
})(current, template, email, email_action, event);
Step 2 : Call that mail script in Notification
Output :
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 11:40 PM
Thank you very much. This worked for me!