when a catalog item request is submitted a notification will be triggered to the requestor. We have a field where the requestor can enter multiple email id's as shown in snippet. Now we need to send notification to all the mentioned email id's includ

Neelu S
Tera Contributor

when a catalog item request is submitted a notification will be triggered to the requestor. We have a field where the requestor can enter multiple email id's as shown in snippet. Now we need to send notification to all the mentioned email id's including the requestor. How can we achieve that

1 ACCEPTED SOLUTION

Hello,

No your event Queue declaration needs correction we can send only two parameters in events 

push your requested for email also into the array like below

var emails = current.email_address.split(',');

emails.push(current.variables.requested_for.email.toString());

gs.eventQueue('signavio.request.created' ,current,SON.stringify(jsonObject),emails );

I am sending your resuested for emails and the other emails also at a time  in one parameter instead of multiple

please accept the solution if you find it helpful

View solution in original post

7 REPLIES 7

Mohith Devatte
Tera Sage
Tera Sage

Hello,

I would suggest to change the field type of multiple emails.

Because it will be considered as a entire string but not multiple ones as you are storing it in single line texxt type field 

Use List collector type field and tag users there and then you can write the script as below to get the users in that field and send it in event parameters as recpients 

var emails = current.email_address.split(',').toString();

and pass emails variable as the parameter

please accept the solution if you find it helpful

we cant use list collector as users are not in servicenow user tble

Okay there is only one way to do this then.

Can you make sure that user will enter emails with comma separated values 

like xyz2gmail.com,abc@gamil.com in that field .

This ", " is the way to find or an unique symbol to find out that there are multiple values in teh string field other wise it gonna take all the emails as a single line

yes i can do that . so what should be the script and where exactly i need to write it