- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2019 07:16 AM
Hello I have a workflow which is creating 2 tasks up on firing , but if one task is closed another task is marked closed in complete , , i searched in community , they mentioned to use wait for WF event , but not sure what to select in that
I added Wait for completion on both tasks .
there is another scenario where only 1 task will be created , then how to address that , If i use the wait for WF event then as it will be waiting for another task to complete (which is not going to happen as the condition is not satisfied )
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2019 08:30 AM
var rec = new GlideRecord('sc_task');
rec.addQuery('request_item', current.getValue('sys_id'));
rec.addQuery('state','NOT IN','3,4,7');
rec.query();
if(rec.hasNext()){
answer = false;
}
else{
//Continue
answer = true;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2019 08:18 AM
Hi,
Add "Wait for condition" activity before "End" activity and use the following as "Condition Script" of this activity.
var gr= new GlideRecord('sc_task');
gr.addQuery('request_item',current.sys_id);
gr.addActiveQuery();
gr.query();
if(gr.next()){
answer = false;
}
else{
answer = true;
}
Hope this helps!
Thanks,
Archana
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2019 08:27 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2019 08:30 AM
var rec = new GlideRecord('sc_task');
rec.addQuery('request_item', current.getValue('sys_id'));
rec.addQuery('state','NOT IN','3,4,7');
rec.query();
if(rec.hasNext()){
answer = false;
}
else{
//Continue
answer = true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2019 08:34 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2019 08:37 AM
can you check if you have any custom business rules running on the sc_task that are cancelling the workflow?