Wait for all tasks to be closed ( in the workflow)

sonita
Giga Guru

The requirement is to check to see if all the tasks are closed . Not sure what the script would be like:

find_real_file.png

1 ACCEPTED SOLUTION

kristenankeny
Tera Guru

This is the script I'm using:



ifScript();



function ifScript() {


  var t = new GlideRecord('sc_task');


  t.addNotNullQuery('order');


  t.addQuery('request_item',current.sys_id);


  t.addQuery('active',true);


  t.query();



  if(t.hasNext()){


  answer = false;


  }


  else{


  //Continue


  answer = true;


  }


}


View solution in original post

7 REPLIES 7

If the ad-hoc tasks have values in both request_item and active (or any other fields that you're querying on), then I would suggest adding logging on the script to see which records it's identifying. Can you also provide an image of the workflow leading up to and after your wait condition? Preferably one that proceeded even with active ad-hoc tasks?


So, it doesn't proceed, it just sits there. If I do this on tasks created through the workflow, it works fine. The join "card" was just an attempt at some other issue, and the behavior was the same with, or without.


closed tasks.PNGhungworkflow.PNG


Did adding logging to your wait for condition script give you any clues to what it has found as the tasks are closed?