The CreatorCon Call for Content is officially open! Get started here.

Email notification for Watchlist

Cupcake
Mega Guru

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

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

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


find_real_file.png



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


BR1.PNG


3) Change your existing email notification as shown below


find_real_file.png


find_real_file.png




Thanks,


Abhinay


Please mark Helpful, Like, or Correct depending on the impact of the response


View solution in original post

27 REPLIES 27

Just did what you said, now when I do my testing steps that I gave above. The watchlist notifcation is not going to anyone.


I added two people to the watchlist and no notification to either one.



find_real_file.png


find_real_file.png


That is weird. I have tested this on my end.   Attach a screen shot of your email notification of Who Will receive tab.


Here are all of my screenshots of my email notification, the event and the business rule. It still didn't work.


I created a brand new ticket - no one on the watchlist, then I went back into the ticket and added someone to the watchlist. No notification. See all screenshots below.


find_real_file.png


find_real_file.png


find_real_file.png



The event


find_real_file.png


The business rule


find_real_file.png


find_real_file.png



The ticket


find_real_file.png



find_real_file.png



find_real_file.png


If you had followed my correct answer carefully, there would have been no issues . In your email notification, the event name is incident.updated, it should be you newly created event watchlist_add. Change the event name on your notification to watchlist_add.


Sorry for the small oversight. I thought I did change the event name, maybe it didn't save.


However, the event name is now watchlist_add and it still didn't work.


find_real_file.png



find_real_file.png



find_real_file.png