Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to get recipient list inside email notification script ?

ASA5
Kilo Sage

Hello ,

I want to get the list of recipient inside a notification email script.

Here is the code i used inside the notification email script.

var recipients   = email.recipients;

gs.log("recipients :   "+recipients,"me");

When i check the system log i found recipient empty.

9 REPLIES 9

Mihir Mohanta
Kilo Sage

recipient lists are separated by comma ?



Thanks,


Mihir


Yes in the notification recipient lists are separated by comma, but when i use gs.log("recipients :   "+recipients,"me"); in notification email script its empty.


Create a event based notification whose parameter 1 contains receipient.



In the email script write script like



var recipients   = email.recipients.split(',');


for (var i=0; i<recipients.length;i++){


eventQueue('eventname', current, recipients[i]); //change the event name


}




Thanks,


Mihir


Thank you Mihir Mohanta for you answer, The notification is sent when an incident is created , should i create an other event as you mentioned?