How should I set Parm 1 to send a E-mail to multiple users at same time?

Kento Takahashi
Giga Contributor

Hi all,

I would like to send a E-mail to multiple user by using Email notification.

Now, I set up like as below.

-a business rule creates a event by using "gs.eventQueue()"

-the event gets pram 1 correctlly

-the value of parm 1 is "xxx@example.com, yyy@example.com, zzz@example.com"

-a event trigers E-mail notification and a E-mail is sent

-the recipients of the E-mail is only "xxx@example.com"

 

How should I set some E-mail addresses to Parm 1?

If someone knows, please let me know.

 

1 ACCEPTED SOLUTION

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

You will have to create a loop in business rule.

For example:

var emailID = "xxx@example.com, yyy@example.com, zzz@example.com";

var spl = emailID.split(',');

var len = spl.length;

for(var i=0; i<len;i++){

gs.eventQueue('eventname',current,spl(i));

}

 

Note: Please check this code properly. Consider this to be sample.

 

THanks,
Ashutosh

View solution in original post

6 REPLIES 6

FIKRI BENBRAHIM
Kilo Guru

Hello Kento,

 

   This would be a normal behavior if you are getting just one value in the parameter you are passing to Param2 or if you are not looping on the users got from the users list.

   

   In order to send this notification to multiple users, you should use a glide record in which you get all the users you want the email to sent. After, you should put a while loop on the list of your users and use the gs.eventQueue() to call the notification and in Param2 you pass the users your iterating on.

    

   Here is the doc for cusing gs.EventQueue() method : https://developer.servicenow.com/app.do#!/lp/new_to_servicenow/app_store_learnv2_automatingapps_king....

 

Cheers

 

Hello,

 

Thank you so much.

I understand and it is working as I desire.

Thanks

 

Kento