Notification to send to users when they are added to the watchlist
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2023 07:19 AM
Hi,
I would like to create a notification to send to users whenever they are specifically added to the watchlist. What is the best way to configure this?
I understand we can create the notification and add the trigger, record updated or created with the condition: watchlist changes.
But i dont know how that would work because that would mean whenever the watchlist changes, such as removing a user from the watchlist or adding an additional user to the watchlist, then the notification email will be sent each time.
Can somebody please help me to understand the best way to set this up and how i can do this please?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2023 07:45 AM
Off the top of my head I don't think you are going to be able to run a script in the notification to do this because Previous is not available.
You will need to add an After Update/Insert BR that triggers when the watch list changes. Then you can compare the field values in Previous and Current to find who was added and removed then trigger events setting Parm1 and or Parm2 to the sys_id's of the users who should get the email.
So something like the below. I did not test.
(function executeRule(current, previous /*null when async*/) {
var added = [];
var removed = [];
var cw = [];
var pw = [];
if(current.watch_list)
cw = ("" + current.getValue("watch_list")).split(",");
if(previous.watch_list)
pw = ("" + previous.getValue("watch_list")).split(",");
added = (new ArrayUtil()).diff(cw, pw);
removed = (new ArrayUtil()).diff(pw, cw);
gs.eventQueue("SOME_EVENT_NAME_TIED_TO_NOTIFICATION_ADD", current, added);
gs.eventQueue("SOME_EVENT_NAME_TIED_TO_NOTIFICATION_REMOVED", current, removed);
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2023 08:53 AM
Hey JHughes62,
Check out this community article it should help you!
Mark helpful if my response helped!
Thanks,
Abdul Rahim