- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2025 12:19 AM
Hi Team,
We are working on SLA notifications, below is the example of the notification that got triggered when an event is fired (75 % breach)
sub : SLA "XYZ- P3 resolution (2 days)" associated with INC0017809 has reached 75.02% of its allowed duration
Now we have to make the 75.o2 to 75 only
what is the easiest way to achieve it ?
Regards
B Sva Teja
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2025 03:01 AM
It comes from this OOTB Notification:
https://instanceName.service-now.com/nav_to.do?uri=sysevent_email_action.do?sys_id=9660628ed7a2220035ae23c7ce61039e%26sysparm_view=advanced
Steps to achieve
1) remove the subject from subject field
2) then update any of the existing email script and set the subject. I selected this "sla.salutation.event_parm1"
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var breachPercentage = parseInt(current.business_percentage);
gs.info('ARB breachPercentage' + breachPercentage);
var subject = "SLA " + current.sla.getDisplayValue() + " associated with " + current.task.number + "has reached " + breachPercentage + "%";
email.setSubject(subject);
var user = GlideUser.getUserByID(event.parm1);
if (user.exists())
template.print(gs.getMessage("Hello {0},", user.getDisplayName()));
else
template.print(gs.getMessage("Hello,"));
})(current, template, email, email_action, event);
Output: When I previewed the notification
The percentage 13.78% got converted to 13
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2025 12:23 AM
if that's the OOTB email then you will have to use email script and convert that decimal to integer value and then print using template.print()
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2025 02:13 AM
Will it work in the subject of the mail ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2025 02:27 AM
using email script you can set the subject as well
// ensure you convert decimal to integer before setting the subject.
var str = 'Your subject';
email.setSubject(str);
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2025 02:32 AM
@Ankur Bawiskar Can you please elaborate