Workflow - "Wait for Condition" activity
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi All,
I have put the Wait for Condition activity in the workflow with the condition:
1. Approval is Approved
2. A particular catalog task should be closed
then only the workflow should move forward but the WF is not moving forward. The WF is getting stuck at the Wait for Condition.
Can someone please tell me what is the issue and how that can be fixed?
Thanks,
Rooma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Brad Bowman Its not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
workflow wait for condition will proceed only when update happens on RITM.
Since you are waiting on some other record it won't work directly.
Do this -> mimic update on RITM
1) have after update BR on sc_task
Condition: current.request_item.cat_item.name == 'Your Item' && Active [Changes to] False && Short Description [STARTS WITH] Review Request
Script:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var wf = new Workflow();
var ri = new GlideRecord("sc_req_item");
if (ri.get(current.request_item)) {
wf.runFlows(ri, 'update');
}
})(current, previous);
Also workflow wait for condition requires answer = true/false
If answer=true it will proceed as condition is met
So instead of returning yes or no, return boolean true and false in your script
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Ankur Bawiskar Its not working even I created the BR and set the answer as True.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
it should work fine.
what debugging did you do?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I ran the workflow script in the background script and it is returning true. Other than that I am not sure how and where to debug.