Restrict to only one notification when RITM Additional Comments gets changed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 01:23 AM
Hi All,
I am trying to achieve a scenario when the notification should get triggered only once RITM additional comments gets populated from SCTASK. Presently when the fulfiller of the SCTASK is adding a comment in SCTASK the RITM Additional Comment is getting populated twice.
I have written a BR where I am trying to restrict the second trigger of notification as shown below, but somehow it is not working ( perhaps of the if condition ) ?
var addCom = current.comments.getJournalEntry(1);
gs.info("Additional Comments from RITM::: " + addCom);
if (addCom.indexOf('Comment from Task') == 0) {
var grScTask = new GlideRecord('sc_task');
grScTask.addQuery('request_item', sysID);
grScTask.setLimit(1);
grScTask.query();
if (grScTask.next()) {
gs.eventQueue('Notify_Assignee_PFNA_RITM_Update', grScTask, grScTask.assigned_to.email);
}
} else {
return;
}
Can someone please help ?
Regards,
Saurabh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 03:35 AM
are you trying to sync comments between RITM and SC TASK?
I think it's going in some loop
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2024 05:18 AM
Hi @Ankur , Yes it is in a loop. I have achieved this finally by changing the BR to "before" update.
Regards,
Saurabh