Workflow activity 'Wait for Condition' always needs a 'Nudge'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2017 12:04 PM
I have the following 'Wait for Condition' script. When the step runs the first time the value is 'requested'. Whether it is 'approved' or 'rejected' the activity won't trigger when the approval/rejection is done and the task 'parent status approval' is updated.
I get the workflow to continue I have to go into the activity context for the RI and 'Nudge' the workflow, and then it continues on as it should. What am I missing? TIA
//*****************Need to check approval record*****************
var grTask = new GlideRecord('sc_task');
grTask.addQuery('request_item', current.sys_id); ///'RITM0011604');
grTask.query();
if(grTask.next()) {
gs.log('BS Decision-' + grTask.approval);
if (grTask.approval == 'approved' || grTask.approval == 'rejected' ) {
answer = true;
}
}
- Labels:
-
Best Practices
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2017 12:14 PM
Hello Christina,
Quick question:
1.What if there are multiple tasks for a requested item? Currently I don't see you checking for multiple task.
2.Also did you mean that workflow only proceeds when u make manual update on request item?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2017 12:22 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2017 01:01 PM
Hello Christina,
Thanks for the update. In this case, you need to trigger the workflow via script i.e use runFlows. The workflow will resume the activities only when there is an update on the item ticket.
Create a Business rule on sc_task table and trigger the item workflow as per your req.
More info here.
http://wiki.servicenow.com/index.php?title=Workflow_Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2017 10:14 AM