Passing more than two parameters in event queue

Avee90
Tera Contributor

Hello Folks,

      I'm trying to pass 4 parameters thru event queue from a scheduled job run script. In parm 1 I'm passing sys_id for recipients, parm 2 passing Json object to use in mail body. I need to pass two more parms thru event queue. But it is not working. Can anyone help me out to pass more than two parm thru event queue to use in mail body.

Thanks in advance.

4 REPLIES 4

Sumanth16
Kilo Patron

Hi Naveen,

Use below method to pass multiple parameters:

 

var jsonObj = {};
jsonObj.name = 'Abel Tuter';
jsonObj.email = 'abel.tuter@example.com';

gs.eventQueue('Event Name', GlideRecord Obj, recipientArray, JSON.stringify(jsonObj));

In the email script use this to parse the json

var jsonObj = JSON.parse(event.parm2);

var email = jsonObj.email;
var name = jsonObj.name;

 

 

Thanks & Regards,
Sumanth Meda

Avee90
Tera Contributor

I'm triggering event thru scheduled job and I've written script for JSON obj there. How can i use script in mail script

Hi naveen, 

 

You can add multiple parameters in JSON

 

Please refer to below thread:

https://www.servicenow.com/community/developer-forum/how-to-access-event-parm1-in-mail-script/m-p/16...

 

Please mark it as helpful (or) correct if it helps.

 

Thanks & Regards,
Sumanth Meda

AshishKM
Kilo Patron
Kilo Patron

Hi @Avee90 , 

As you already using the JSON for parm2, you can add more values in the same JSON and later parse the JSON and retrieve the value. 

 

Refer the API page

https://developer.servicenow.com/dev.do#!/reference/api/washingtondc/server/no-namespace/c_GlideSyst...

 

 

-Thanks,

AshishLM


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution