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.

Output of gs.log from Workflow Run Script

Arijit6
Kilo Contributor

Hi I am trying to debug the follwoing code by trying to determine the location value. I have used a gs.log statement, however when I try to check the 'script log statements' and search for the string "ABCD" I don't find anything. Can you please advise how to check the output of the gs.log as I am trying to see what value is returned.

 

//var getServiceString = current.variables.server_name.toString();
//var getServiceArray = getServiceString.split(",");

var taskList=[];
{
var description = 'Requested For: '+current.variables.requested_for.name +'\n ';


//gs.print('VMP provisioning - i '+(getServiceArray[i]).trim());
var gr = new GlideRecord('sc_task');
gr.initialize();
gr.request =current.request;
gr.request =current.request;
gr.request_item = current.sys_id;
gr.short_description = 'Approved WFH Kit Review and Fulfilment Task ';
gr.description = 'A WFH Kit reimbursement request has been approved. Please Review and Fulfil this request';
gs.log('TEST ABCDEF '+current.variables.requested_for.location.country);
if(current.variables.requested_for_country == 'PH')
{
gr.assignment_group='9b9aa55fdb9e2c5098a059364a961985';
gr.assigned_to ='e90c60e8db2207003fbd788bbf96196f';
}
else if(current.variables.requested_for_country != 'PH')
{
gr.assignment_group='6f041e72db62a0140450e4e38a9619bb';
gr.assigned_to ='cdebe2dddb5613408c37325d7c9619e2';
}
gr.state=3;
var getTask = gr.insert();
taskList.push(getTask);
//gr.state=3;
//gr.update();
}

workflow.scratchpad.task=(taskList).toString();

 

7 REPLIES 7

Hi, before posting my response I tested and confirmed that gs.log() and gs.info() functioned when added to a workflow run script. As previously suggested your should add a log statement to the first line of your script to confirm that the script starts to run, then add additional logs until you identify your issue - starting from the top and working down your code.

John Zhang1
Kilo Patron
Kilo Patron

There are four debug methods blow, but for workflow.debug() method, you need to Workflow > Administration > Properties 

find_real_file.png

find_real_file.png

Can you please advise how to Navigate to the Workflow Log? I tried searching for Workflow Log in filter navigator but doesnt appear.