
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2016 11:56 AM
I have an email notification that I created for when someone is added to the Watch list.
The intent is to send the notification to the user when they are added to the Watch list. The notification works perfectly - the condition is set to fire when the Watch list changes; however, I am wondering is there a way (script or something) that can be done to only send the notification to the person that was added to the watchlist.
Thank you,
Karen
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2016 12:37 PM
Karen,
Create a new event on the table you want it to fire. Then create a business rule and log that event from the business rule as shown below. Change your email notification to be triggered when an event is fired and select the event. In "Who will receive" tab check the event parameter 1 contains recipient as shown below.
1) create a new event by going to "Event Registry" module
2) Create a new before business rule
when: before insert and update
conditions:watch_list changes
Script:
var array= new ArrayUtil();
var currArr=current.watch_list.split(',');
var prevArr=previous.watch_list.split(',');
if(array.diff(currArr, prevArr).length>0){
gs.eventQueue('watchlist_add', current,array.diff(currArr, prevArr).toString());
}
Note: copy this script inside the onBefore function( from Fuji onwards). Before Fuji create a new function and copy this script inside that function and call the function
3) Change your existing email notification as shown below
Thanks,
Abhinay
Please mark Helpful, Like, or Correct depending on the impact of the response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2016 12:05 PM
Karen,
In your business rule add few log statements and see what the logs shows
var array= new ArrayUtil();
var currArr=current.watch_list.split(',');
gs.log("current list "+ currArr);
var prevArr=previous.watch_list.split(',');
gs.log("previous list "+prevArr);
if(array.diff(currArr, prevArr).length>0){
gs.eventQueue('watchlist_add', current,array.diff(currArr, prevArr).toString());
}
gs.log("Final "+array.diff(currArr, prevArr).toString());

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 04:35 AM
Good morning Abhinay,
I updated the business rule this morning and tested again using the same steps. I still received the same end result. Instead of the email ONLY going to the newly added recipient to the watchlist, it still sent it to both people.
Thanks,
Karen

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 06:19 AM
Did you the parm1 in the email notification? Can you attach a screen shot of Who will receive tab in your notification?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 08:04 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 08:06 AM
There you go. You should not select the watch list in your users/ groups. Take that off and check the checkbox Event pam1 contains recipient and you are good to go.