- 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 09:45 PM - edited 10-19-2023 09:52 PM
Hello @Appu2 ,
Use email script for the same.
Check if priority is low then set color as green and so on.
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 09:51 PM
Hi @Harsh_Deep
Can you provide me the code for Email script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 09:57 PM
Hello @Appu2 ,
Please refer this -
and for the color coding use this-
template.print('<table style="margin-left: auto; margin-right: auto; border-collapse: collapse; width: 100%; font-family: verdana, geneva; font-size: 8pt;" border="1">');
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:05 PM
How to add different colors for choices? The above code didn't gave the color just displayed the priority!