- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
9 hours ago - last edited 9 hours ago
Hi All,
I don't want to trigger the notification when any attachment is added or deleted,
actually we are getting the ticket from the record producer and there is activity whenever any attachment will add or delete it is saving in the comments, and we have written condition in the notification to run whenever the comments changes and this notification goes to requested for.
So how can i prevent the nofitication just for the attachments.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
use this script in the advanced notification condition
var commentText = current.comments.getJournalEntry(1);
if (commentText.indexOf('deleted an attachment') > -1 || commentText.indexOf('added attachment') > -1) {
answer = false;
}
else{
answer = true;
}
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
8 hours ago
Hi @Devansh1 ,
two ways you can achieve this
1. fine the BR or whatever is adding the comment and add setWorkflow(false) to it
or
in the notification condition add this below code
answer = true;
var jfGr = new GlideRecord('sys_journal_field');
jfGr.setLimit(1);
jfGr.addEncodedQuery('element=comments^element_id=' + current.getValue('sys_id'));
jfGr.orderByDesc('sys_created_on');
jfGr.query();
if (jfGr.next()) {
if (jfGr.getValue('value') == 'deleted an attachment' || jfGr.getValue('value') == 'added attachment') {
answer = false;
}
}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
use this script in the advanced notification condition
var commentText = current.comments.getJournalEntry(1);
if (commentText.indexOf('deleted an attachment') > -1 || commentText.indexOf('added attachment') > -1) {
answer = false;
}
else{
answer = true;
}
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
8 hours ago
It's working
Many thanks