Catalog Tasks are automatically getting closed incomplete

Rishi32
Tera Contributor

Hi All,

In workflow, we have 6 catalog tasks, if we close 4 tasks remaing 2 tasks are getting closed incomplete, even we didn't take any action, there is no script to close remaining tasks set to be closed incomplete, could anyone please help ow to identify the cause.

Thanks

Rishi

4 REPLIES 4

Brad Bowman
Kilo Patron
Kilo Patron

Hi Rishi,

This is either determined by a Business Rule running on the sc_task table, or within the Workflow or Flow for this Catalog Item.  If you post the Workflow or Flow that will help show what's going on.

Hi Brad,

Thanks for your reply. This the workflow, after completion of some tasks the remaining tasks are cancelled automatically. Please find the below screenshot.

find_real_file.png

Hi Rishi,

The reason behind the cancellation of task is, there is no wait for condition for all task when the branches join, once the other tasks are competed the workflow ends or proceeds. You need to have a wait for wherever the tasks branches join.

Please find the below script which you can use in wait for condition activity.

var rec = new GlideRecord('sc_task');
rec.addQuery('request_item', current.getValue('sys_id'));
rec.addQuery('state','NOT IN','3,4,7');
rec.query();
if(rec.hasNext()){
answer = false;
}
else{
//Continue
answer = true;
}

Kindly mark my answer as correct and Helpful based on the Impact.

Regards,

Alok

It's difficult to determine without seeing the entire workflow, but if the blue arrows from either completed Catalog Task are leading to a path that goes to the end, then the workflow is completed so any pending catalog tasks are closed incomplete due to an out of the box business rule to clean things up when a workflow/RITM ends.  When creating a Catalog Task activity that runs in parallel instead of in sequence - that is when there is more than one arrow/path leading from a previous activity into more than one Catalog Task, and/or the path leading out of a Catalog Task does not lead directly or indirectly to the next Catalog Task, then you should have a Branch activity from the previous activity on a single path, which leads into each next path - so this goes where the path splits, rather than having multiple paths come out of one activity like your Set Values shown above.  This Branch activity is not required, but helps make the workflow more understandable to someone looking at it who didn't create it or work on it recently.  The key activity that appears to be missing for your multiple paths to wait at some point before continuing to the End activity or whatever happens after all paths/tasks are complete is a Join activity.  Each Catalog Task activity should directly or indirectly (after another/other activity(ies)) lead into the Join activity, and both the Complete and Incomplete results of the Join should lead to the next single path activity.