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

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;


  }


}


Note: you probably don't need to "order" line - we are using this for controllling open/close of tasks auto-generated by the workflow.


Thanks!!!


What about ad-hoc tasks? I can't seem to make it work even though it is tied to the RITM number. Your query works just fine for a workflow created task.