I require a Workflow wait for condition to wait for 4 change tasks to complete before moving to raise the next change task.

stevelucas
Kilo Expert

Hi,

 

I have a workflow which requires 4 change tasks to be completed before moving to the next stage - see attachment.

Does anyone have a script that could help.

 

Thanks

 

Steve

1 ACCEPTED SOLUTION

bgworld
Giga Expert

I would suggest to use join activity. It works the same way as you need it as per your problem description.



Utility Activities - ServiceNow Wiki


View solution in original post

6 REPLIES 6

Mark Laucus
Giga Guru

I use something similar to whatTim Black uses except I just check for active tasks.   Also note it is good to check other types of records to see if they tasks are closed or not before processing.



//Query for all tasks to see if they are inactive


var rec = new GlideRecord('change_task');


rec.addQuery('change_request', current.sys_id);


rec.addQuery('active', true);


rec.query();


if(rec.hasNext()){


  answer = false;


}


else{


  //Continue


  answer = true;


}


I do the same if i am waiting for ALL tasks to close.. in this case he stated he needed to wait for just those four tasks to close



i also see a parallel branch off of task 1.. so a normal join may not be reliable in this case.. which is why i suggested using workflow variables as tags.. and just wait for all for tags to go true.