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 is not working

Chandresh
Tera Guru

I have invoked an event by business rule and that event is triggering fine. I have checked that in the event log.

The main issue is I have created one script action corresponding to that event but that script action is not working. All I am doing in that script action is creating records.Please check attached snapshot.

Is there any issue with the script action script.?

event.PNG

13 REPLIES 13

Sure , I will give it a try and come back with my findings.


I think you may have something else going on than just the Script Action. I found this when researching the same getEventLog() message you were. I did a quick test with a new event that creates a glide record, and everything seemed to work fine for both an OOTB table and a new table.


venkatiyer1
Giga Guru

Hi Chandresh,



May be it is just a timing issue and you may want to run your insert record asynchronously.



var job = new GlideRunScriptJob();
job.scheduleScript("new CustomScriptInclude().insertShift()");


// if Customscriptinclude is your defined script include



alternatively, you can pass it as string too:



var script = "var gr= new GlideRecord('u_shifts');";


script += "gr.initialize();";


...



script += "gr.insert();";


var job = new GlideRunScriptJob();


job.scheduleScript(script);





Anand Chauhan
Kilo Explorer

Hi Chandresh, 

I too face the same issue, You could do one thing please check your calling of gs.evenQueue() function . The function must be called for single record only not for multiple records