Debugging Workflows

Woz
Tera Contributor

Hello,

I had a problem with one of my workflows (which I have now fixed). While i was trying to work out how to fix it I tired to debug the workflow using a run script action and had been into workflow properties to enable workflow debugging

Below is the script I was using to debug and I was looking in system logs> all  for the logs

find_real_file.png

 

//Find all incidents with a priority of 1 or 2
var gr = new GlideRecord('sysapproval_approver');

gr.addQuery('sysapproval', current.Number);
//gr.addQuery('state', 'approved');
gr.query();
while (gr.next())
{
    workflow.info('Number' + current.Number);
    workflow.info('approval for' + sysapproval);
    workflow.info('state' + state);

}

 

Why cant I see workflow logs? How should I be debugging workflows?

4 REPLIES 4

darbour
Mega Contributor

What table is this workflow running on?

darbour
Mega Contributor

In the Approvals table, sysapproval is a reference field, so you have to query it with a sys_id. See if this works for you:

(function (current) {
    var gr = new GlideRecord('sysapproval_approver');
    gr.addQuery('sysapproval', current.sys_id);
    gr.query()

    while (gr.next()) {
        // log using workflow.info()
    }
})(current);

Also, current.Number should be current.number.

Supriya Sirse1
Giga Expert

Hi,

If you enable the glide.workflow.log.debug property (should only be done on non-production instances) you can utilize the workflow.debug() method to log messages to your workflow context record.

You can also utilize workflow.info(), workflow.warn(), or workflow.error() when appropriate.

=====================

More information please find below link:

https://hi.service-now.com/kb_view.do?sysparm_article=KB0538547

Regards,

Supriya S.

 

Please Hit Correct, ️Helpful depending on the impact of the response

Trupti6
Tera Expert

Hi,

Try to debug workflow from active context and check in workflow Activity History, Workflow logs in bottom section.find_real_file.png