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.

Code working in background script but not working in run script(workflow).

SD4
Tera Contributor

I am getting approver name 

var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('sysapproval.number','RITM0395743');
gr.addQuery('state','requested');
gr.query();

if(gr.next())
{
gs.log(gr.approver.name,"Approver");

}

find_real_file.png

but when I am using the same code in the run script, it does not even go into the if statement

find_real_file.png

5 REPLIES 5

If var ritm = current.number.toString() or var ritm = current.getValue('number') doesn't work, the only other thing I can think of is that maybe your workflow is running in a scoped application, where gs.log() doesn't work. Try using gs.info() instead