How to pass 3 parameter from event queue and use it in notification.

Priya75
Tera Contributor

Hi All,


I want to pass 3 parameters to in event queue, 

 

gs.eventQueue("event name", current, current.assignment_group ,(value1,value2 ));

 

I want to use value 1 and value 2 in notification;

 

 

6 REPLIES 6

Mohan raj
Mega Sage

Hi @Priya75,

 

Try to get value and store in different variable and push all variable into an array and pass the array in gs.eventQueue() method.

 

For example:

var value1 = current.caller_id.toString();
var value2 = current.assigned_to.toString();
var result = [value1,value2];

gs.eventQueue("event name", current, current.assignment_group , result);

 

Get value 1 and value 2 in script, use email script 

Email Script:

var response  = event.parm2.toString().split(',');
var caller = response[0];
var assignedTo = response[1];

 

If my response helps you to resolve the issue close the question by Accepting solution and hit thumb icon. From Correct answers others will get benefited in future.

Ahmmed Ali
Mega Sage

Hello @Priya75 

 

The eventQueue() function expects only two parameters. If you have multiple data to be passed, you can create object to store all the data and then create JSON string out of the same object, and pass that string in one of the parameter.

 

Now in notification, you can create one email script, in email script you can read the JSON string and parse it to get the object. Now you can read values from the object and print the same in notification.

 

Example: while triggering the event

var obj1 = {};

obj1.key1 = "Value 1";

obj1.key2 = "Value 2"; //you can add any data here

var jsonVarValues = JSON.stringify(obj1);

 

gs.eventQueue("event name", current, current.assignment_group ,jsonVarValues );

 

 

in email script:

var jsonSt = event.parm1;

var obj1 = JSON.parse(jsonSt);

 

//now you can read the data and print

template.print("First group: " + obj1.key1);

 

Thanks,

Ali

 

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

  • how do i print these values in notification, i want to print value 1 and value 2,

eg:- Hi team,

value1 ticket has changed to a value2.

@Priya75 

you need to use email script for this and parse the json and get the values

script is already shared by Ahmmed

what didn't work for you?

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader