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
03-01-2017 11:25 AM
Can you please paste the script here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2017 11:27 AM
//****************Need to check approval record****************
var grTask = new GlideRecord('sc_task');
grTask.addQuery('request_item', current.sys_id); ///'RITM0011604');
//grTask.addQuery('approval', 'approved');
//grTask.addOrCondition('approval', 'rejected');
grTask.query();
if(grTask.next()) {
gs.log('BS Decision-' + grTask.approval);
if (grTask.approval == 'approved' || grTask.approval == 'rejected' ) {
answer = true;
}
// else { answer = false;
// }
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2017 11:28 AM
I think this goes as part of your workflow activity run script. You need to create a BR on sc_task table to trigger the workflow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2017 11:37 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2017 11:48 AM
Thanks for the details and screenshot. I don't see any issues with the script.
I can take a look and debug if this is on your personal dev instance.