ServiceNow Email notification event query script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2017 02:20 AM
I am using ServiceNow platform.
I have a requirement in email notification to show the latest work notes ONLY if the work notes have been updated.
Is it possible to query the events queue directly in the email notification and use that event to evaluate an if statement?
The mail script I have right now will display the latest work notes if there are work notes at all, but we just want display it when the work notes were updated only.
The notification is being triggered on the condition that either the additional comments were updated or the assignment group or assigned to changes. So I can't use a simple condition builder.
I also considered the technique in this post but I'm wondering if there is a better way to do this in 2015, this post was back in 2011.
<mail_script>
var worknotes = current.work_notes.getJournalEntry(1);
if (worknotes !='') {
template.print("Latest Work Notes:");
template.print(current.work_notes.getJournalEntry(1));
}
</mail_script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2017 02:51 AM
Hi Nagesh,
Did you try the changes() method for glide elements?
if(current.work_notes.changes()){
//this condition will work only if there is a new work note added. You can add in it in notification email script.
}