Scripted notification recipients

xiaix
Tera Guru

I have a Notification record on the incident table:

find_real_file.png

 

I want to script the recipient list "Who will receive". 

find_real_file.png

 

How can I script the recipient list?

1 ACCEPTED SOLUTION

Brian Lancaster
Tera Sage

I believe you would have to change send when drop down to  an event is triggered.  An then use a business rule to trigger the event and then on the who will receive  there should be a check box "Event parm 1 contains recipient".  Then and determine in you business rule who will get it and use gs.eventQueue to fire the event.

gs.eventQueue('Event Name', current, list of recipients);

View solution in original post

16 REPLIES 16

1. go to event registry and create an event eg new.event.name

2. create a before update BR on the table your notification is being sent from

3. use glide records or list fields or whatever to populate an array with your recipients (array content can be a sys_id of a user record or an email address)

4. use gs.eventQueue() to generate your event eg:

gs.eventQueue('new.event.name', current, userArray);

5. create a notification and set it to be triggered by the firing of your new event in the when to send tab

6. tick the 'event parm1 contains recipients' box in the who to send to tab

7. put in, like, message content etc

8. test

Think that covers it more or less. Any particular bit you're getting stuck on?

 

Thanks... I'm almost ready to test. 

Your step 6 mentions "parm1", however mine says "parm2":

find_real_file.png

Does that matter?

You should have both but if not you can just do something like this.

gs.eventQueue('event name', current, '', 'event parm2 variable to send');

the eventQueue can send through two parameters, you should have both options in the when to send tab, maybe check your form layout if not. not sure why someone would remove that but stranger things have happened.

find_real_file.png

I was blind... parm1 options is there, just was on the left hand column!  lol