Catalog Tasks getting cancelled automcatically

kailashthiyagar
Kilo Guru

In my workflow, i have a catalog task which is connected to another catalog task. and i have wait for condition also.

On closure of Task 4, task 6 should be created but in my scenario, task 6 is created and getting cancelled while the RITM is getting moved to completed state. Could someone help me on this

Catalog Stage.jpg

24 REPLIES 24

vaibhavshinde
Kilo Expert

Usually Catalog Tasks get cancelled after the parent RITM is closed. Check Business Rule 'request item closure'.



Can you check if the workflow is getting closed through some other activity?


And in your case, looks like Catalog Task 8 reaches the closure first and then closes the RITM.



Add wait for condition in your workflow. Condition Activities - ServiceNow Wiki Code for the same is enclosed in this wiki article.



PS: Hit like, Helpful or Correct depending on the impact of the response


I m using the same script as in the example as Wait for condition. In the snapshot, the flow doesnt go via Task 8. Once i close Task 4, task 6 gets created and cancelled. I assume that somehow the parent RITM gets completed first and so the task goes to cancelled status automatically but not sure why



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.query();


if (gr_tsk.next()) {


  answer = false;


} else {


  answer = true;


}


I see a blue line over task 7 and 5. What is that?


Also i would recommend using Wait for Condition in this situation. Because Timer will just pause the workflow for certain time.