Debugging Workflows
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2018 12:04 PM
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 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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2018 12:16 PM
What table is this workflow running on?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2018 12:28 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2018 11:09 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2018 11:20 PM