Sequential task generation

sunny13
Giga Expert

I want to develop a workflow such a way that i want my workflow to wait till one task is Resolved/Closed complete and then move to next task.

I'm trying to achieve   this with a "wait for condition" since i also want to check the state = Resolved.

find_real_file.png

Also what happens is when i Resolve one task it "Resolve" my RITM as well it did not wait for another task to get generated   but as per i requirement i want my RITM not to get resolved / closed until all my tasks are resolved / complete

I'm not sure whether the issue is clear let me know if you require more details

1 ACCEPTED SOLUTION

yes I know that, What you have mentioned in the question was "I want to develop a workflow such a way that i want my workflow to wait till one task is Resolved/Closed complete". So this can do that trick if closed complete is fine.


If you want to query only based on the resolved state then wait for condition should be used.


Slightly modify your code like,


var gr = new GlideRecord('sc_task');


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


  gr.query();


  gs.log('TASK1 count:'+gr.getRowCount());


  while (gr.next()) {


  gs.log('TASK1 state:'+gr.state);


  if(gr.state != 6)


  {


  gs.log('TASK1 inside if');


  answer = true;


}


}


View solution in original post

11 REPLIES 11

sunny13
Giga Expert

Please fidn the script i used in the "Wait for condition"




answer = ifScript();



function ifScript() {


  var gr = new GlideRecord('sc_task');


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


  gr.query();


  gs.log('TASK1 count:'+gr.getRowCount());


  while (gr.next()) {


  gs.log('TASK1 state:'+gr.state);


  if(gr.state != 6)


  {


  gs.log('TASK1 inside if');


  answer = 'yes';


  }


  }


}



I can see all logs are getting generated but my workflow stops at "wait for condition"


paramveer
Mega Guru

Hi Sajin,



Suppose you need to create 3 task on by one, You can do something like below :



  • Create all the 3 task in parallel at the same time :
  • For first task get the assignment group etc. For rest 2 task set state like pending.
  • Once the first task is closed/resolved, you can make the second task active and set the assignment group etc...
  • Third task will still be pending and will active once second will complete....and so on.


~Paramveer Singh


~Senior Developer



~Please mark Helpful, Like, or Correct Answer if applicable.


Hi Paramveer,



How do you check those conditions?


Hi Bro ,



Can you share the code , i will try to implement it