- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 05:08 AM - edited 05-14-2025 04:11 AM
I have one notification that gets triggered to be sent several weeks before the due date, and every subsequent week after that until the due date.
There is a requirement for the fourth notification that is sent exactly the last week before the due date, to have the email sent as High Importance.
Is there a way to accomplish this using a mail script? I am trying to avoid creating a second duplicate notification just to handle High Importance and would prefer to simplify things and have it handled conditionally in a mail script.
This is what my mail script is now but it's not working. I think it's not working because my notification is triggered from the cmn_location table and so using current.email.importance isn't valid syntax. I'm not sure how to glide into the notification itself.
var gdt = new GlideDateTime().getMonthUTC();
var today = new Date();
var month = gdt;
var dayOfMonth = today.getDate();
var reminder = '';
if (month == 1 && dayOfMonth == 1) {
reminder = 'first';
} else if (month == 1 && dayOfMonth == 7) {
reminder = 'second';
} else if (month == 1 && dayOfMonth == 15) {
reminder = 'third';
} else if (month == 1 && dayOfMonth == 22) {
reminder = 'fourth';
}
if (reminder == 'fourth') {
current.email.importance = 'high';
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 05:47 AM
then have separate notification for 4th iteration and set the Importance=High at notification level
Have a separate event for 4th iteration and link it with above email
In your script when it's 4th iteration, use this event so that the high importance notification is sent
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
05-13-2025 05:35 AM
try setting the Importance to High at notification level
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
05-13-2025 05:40 AM
@Ankur Bawiskar I need to do it conditionally, using a mail script if possible. If I set it to High at the notification level, then every notification will be sent with High Importance. I only need the 4th iteration of the same notification being sent to be sent with High Importance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 05:47 AM
then have separate notification for 4th iteration and set the Importance=High at notification level
Have a separate event for 4th iteration and link it with above email
In your script when it's 4th iteration, use this event so that the high importance notification is sent
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
05-13-2025 05:52 AM
another way is if you have some unique email subject for 4th iteration then you can use before insert BR on sys_email and set the importance field
if(current.subject.indexOf('unique subject for 4th iteration') > -1)
current.importance = 'high';
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