
- 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
‎06-16-2016 01:59 PM
You all are the very best and very efficient with responding.
All is well now.
Thanks,
Karen

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2016 02:01 PM
Glad to know your issue is resolved Karen

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2016 10:59 AM
Hi Pradeep,
Sorry to bother you but it seems that I am still having an issue. I was away on vacation and just getting back to this.
So everything is setup correctly with the below:
1) The email notification,
2) The event, and
3) The business rule
The problem is the customer ONLY wants the email notification to go to ONLY the person that was added to the watchlist. For example, if you are already on the watchlist, and then I am added to the watchlist later - the customer ONLY wants the email notification to go to me, not the people that was already on the list if that makes sense.
Thanks,
Karen

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2016 11:04 AM
Karen,
yes that is what was coded in the business rule too.
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()); // the parameter I have highlighted will do what you are looking for, it will just get the newly added members to the watch list
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2016 11:55 AM
Thank you Abhinay - that is what I thought, still not working. Just checked the script and tested again and this is what is happening. Here are the steps that I took when testing:
1) Impersonated a Service Desk analyst, created a new incident, with no one on the watchlist
2) checked the email logs, the only email sent was to the customer that a new incident was opened for them (me) - That is correct.
3) Went back to the incident as the SD analyst, updated the ticket by added someone to the watchlist
4) Went to the email logs and the watchlist notification was sent to the person added to the watchlist (that is fine)
5) Went back to the incident again as the SD analyst and updated the ticket again by adding another person to the watchlist
6) Checked the email logs, and the watchlist notification was sent to both people on the watchlist. That is NOT correct. The notification should have only been sent to the 2nd person that was added (see my screenshot below)
Thanks,
Karen