Wait for task to complete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2016 07:04 AM
Hi
I have below in workflow. I want to create subtask 1 inside TASK A .once subtask 1 completed, I need to create subtask 1.1 inside
TASK A.
Task A --> subtask 1 --> subtask 1.1
Once subtask1.1 completed, i need to wait till TASK A completed.
I want to create TASK B once TASK A complete..How to set this in workflow?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2016 07:10 AM
Hi
Can you please share your workflow?
By the you can achieve it via "Create Task" activity and choose the table, then have the "Wait For Completion" marked as True.
Please refer the link below.
http://wiki.servicenow.com/index.php?title=Task_Activities#gsc.tab=0
Thanks,
Harshvardhan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2016 07:12 AM
Hi
If I give "Wait For Completion" marked as True., then It will not create subtask 1 inside TASK A which is open

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2016 07:29 AM
Task A- wait for completion false
Sub Task1--wait for completion true
sub task 1.1 wait for completion true
Next activity should be wait for Condition and put this code in the condition script
var gr_tsk = new GlideRecord("sc_task");
gr_tsk.addQuery('request_item', current.sys_id);
gr_tsk.addQuery('state', '!=', '3');
gr_tsk.addQuery('state', '!=', '4');
gr_tsk.addQuery('state', '!=', '7');
gr_tsk.addQuery('wf_activity', '');
gr_tsk.query();
if (gr_tsk.next()) {
answer = false;
} else {
answer = true;
}
Now, create an after business rule on sc_task table
When: after insert and update
Conditions: Request Item.Item is <your item> AND Active changes to false
Script:
var wf = new Workflow();
var ri = new GlideRecord("sc_req_item");
if (ri.get(current.request_item)) {
wf.runFlows(ri, 'update');
}