How to pass Param1 and Param2 values in gs.eventQueue without passing the glide record

harshayern
Giga Contributor

Hi All,

I am working on a inbound action validating data sent in email body with existing table data. I am   triggering a gs.eventQueue when the data passed is not existing in the table.

In the eventQueue i need to pass the Param1 value as email.sender, but to pass this param1 value i need to mention the gliderecord value which is generally current object. But in my script there is no current object which can be passed.

So, i want to check any way by which i can send the param1 value in the eventqueue without mentioning the GlideRecord value.

Thanks,

Harsha

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

I'm not real clear what you are trying to do so I'll throw out several options and you tell me if I hit the mark.



gs.eventQueue('event.name', GlideRecord, parm1, parm2); // standard form



If you don't have a GlideRecord (current, gr, or whatever) it limits you a bit in what you can do with it, but does not render the event completely useless.



gs.eventQueue('event.name', null, event1, parm1, parm2); // sounds like what you are looking for



If you want to send a second GlideRecord, you can stringify/encode the data to JSON and use one of the parms.



var myRec = new GllideRecord('u_my_table');


myRec.get(my_sys_id_from_somewhere_else);


var myRecJSON = JSON.stringify(myRec);


gs.eventQueue('event.name', current, myRecJSON, parm2);



Hope that helps.



GlideSystem - ServiceNow Wiki


View solution in original post

4 REPLIES 4

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Harsha,



Can you hardcode the table name in current object and give it a try. I am not 100% sure if that will work.


Chuck Tomasi
Tera Patron

I'm not real clear what you are trying to do so I'll throw out several options and you tell me if I hit the mark.



gs.eventQueue('event.name', GlideRecord, parm1, parm2); // standard form



If you don't have a GlideRecord (current, gr, or whatever) it limits you a bit in what you can do with it, but does not render the event completely useless.



gs.eventQueue('event.name', null, event1, parm1, parm2); // sounds like what you are looking for



If you want to send a second GlideRecord, you can stringify/encode the data to JSON and use one of the parms.



var myRec = new GllideRecord('u_my_table');


myRec.get(my_sys_id_from_somewhere_else);


var myRecJSON = JSON.stringify(myRec);


gs.eventQueue('event.name', current, myRecJSON, parm2);



Hope that helps.



GlideSystem - ServiceNow Wiki


Hi Chuck,



Passing the null in the eventQueue is working as expected. Thanks for your help.



Thanks,


Harsha


You are very welcome. I'm glad you were able to get your answer. Thank you for participating in the community.