Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Script Action needed

Saib1
Tera Guru

Hi All,

 

how to to access events parameters in script action.

1 ACCEPTED SOLUTION

var stuffYouNeedToPass = 'stuff';
var stuffYouNeedToPass2 = 'stuff2';

//You call the event like this and then add current as the current object, and then you add the parameters the following.
gs.eventQueue('your_event_name', current, stuffYouNeedToPass, stuffYouNeedToPass2); //Call from your ui action, After business rule or whatever. stuffYourNeedToPass will be parm1 and stuffYouNeedToPass2 will be parm2. 

Best regards,
Sebastian Laursen

View solution in original post

3 REPLIES 3

Sebastian L
Mega Sage

Hello,

You can just use event.parm1 and event.parm2 to retrieve the event parameters. Same with "current" 

 

gs.log(event.parm1); //Logs event parameter 1 If you need to pass variables from e.g. business rule
gs.log(event.parm2); //Logs event parameter 2 

gs.log(current); //Logs event current


Best regards,
Sebastian Laursen

Hi Sebastian,

 

How we will pass the parameter from business rule to script action and access in event parameter script action

var stuffYouNeedToPass = 'stuff';
var stuffYouNeedToPass2 = 'stuff2';

//You call the event like this and then add current as the current object, and then you add the parameters the following.
gs.eventQueue('your_event_name', current, stuffYouNeedToPass, stuffYouNeedToPass2); //Call from your ui action, After business rule or whatever. stuffYourNeedToPass will be parm1 and stuffYouNeedToPass2 will be parm2. 

Best regards,
Sebastian Laursen