- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-22-2022 12:22 AM
Hi All,
I have a workflow that creates a single task and other tasks team creates for approvals and stuff. The issue is, once the
workflow created task gets Closed the WF moves to end activity and stage is completed even when other manual tasks are still open. I tried writing a Before/update After/update BR but is not helping. Can you please help?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-22-2022 03:41 AM
Create a Wait for condition with following script:
var task = new GlideRecord("sc_task");
task.addEncodedQuery("stateNOT IN3,4^request_item=" + current.sys_id);
task.query();
var count = task.getRowCount();
if (count == 0)
answer = true;
You can put this inside a function as well. No need of any BR or additional field on RITM level.
Regards,
Rana
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-22-2022 02:10 AM
Hi @Nayan Dhamane It is now not waiting on wait for condition activity but directly closing after first task is closed. Like it was happening earlier.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-22-2022 02:30 AM
Hello @sbeginner ,
What is the conditioni n wait for condition, is the checkbox true or false.
Kindly let me know.
BR,
Nayan
Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-22-2022 02:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-22-2022 03:09 AM
Where is the field All Tasks Closed located? If on RITM, how it is setting to true?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-22-2022 03:11 AM
In the wait for condition activity, try like this:
//Query for all tasks to see if they are inactive
var rec = new GlideRecord('sc_task');
rec.addQuery('request_item', current.sys_id);
rec.addQuery('active', true);
rec.query();
if(rec.hasNext()){
answer = false;
}
else{
//Continue
answer = true;
}