- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2022 09:08 AM
Hi all,
We have a notification set up to notify users that they have been added to the watchlist, which sends the to the watchlist group. However, when an additional user is added, it sends the notification to everyone on the watchlist, even if they have already received the notification before. Is there a way to configure the notification to make it so that only the person who is added to the existing watchlist gets the notification?
Thanks,
Jordan
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2022 10:34 AM
Hi Jordan,
Here is the working code.
Step1 : Create event with name : 'sn_hr_core.watchlist_notification'.
Step 2 : Write After BR on insert, update like below
Condition :
current.watch_list.changes()
Script :
(function executeRule(current, previous /*null when async*/) {
var oldwatch_list = [];
var newwatch_list = [];
var emailTo = [];
if(previous.watch_list)
oldwatch_list = previous.watch_list.split(',');
if (current.watch_list)
newwatch_list = current.watch_list.split(',');
if (oldwatch_list.length == 0)
emailTo = newwatch_list;
else {
for (var i = 0; i < newwatch_list.length; i++) {
if (oldwatch_list.indexOf(newwatch_list[i]) < 0)
emailTo.push(newwatch_list[i]);
}
}
gs.eventQueue('sn_hr_core.watchlist_notification', current, emailTo, gs.getUserDisplayName());
})(current, previous);
Step 3 : Create notification and trigger through event name you created in step 1 and in 'Who will receive' tab just check event Param1 checkbox like below.
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2022 01:49 PM
Thanks for the clear instruction! This worked!