Workflow stuck - Catalog task completed however RITM is still in Fulfillment stage

Raghesh
Giga Expert

Hi,

We have one RITM in Fulfillment stage however the corresponding Catalog task is Closed and Completed. As per the workflow it should automatically close the RITM and REQ once the Catalog task is closed.

This happened to one old request and for the current requests it is working fine.

 

Is there any way we can restart or refresh the workflow to get this RITM closed.

 

I tried the Nudge option in Workflow Context but no luck.

 

 

regards,

Raghesh

 

 

1 ACCEPTED SOLUTION

Hi @Raghesh 

My Mistake.

 

Please put Request Numbers on 2nd line instead of RITM numbers.

 

Or just use number instead of request.number.

 

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023

View solution in original post

14 REPLIES 14

@Raghesh , I won't recommend to close the RITM by using any kind of script as your workflow and subflow is still open. As per screen shot provided, task opened by subflow is still open that's why your RITM has not moved to next stage. Track the Task created by workflow 2 (subflow) and close it. Based on that if there is another task getting open close that as well. Your RITM should close naturally. No need to close it by force.

 

I hope this help.

 

Please mark this helpful if this helps and Accept the solution if this solves your issue.

 

Regards,

Kamlesh

Hi Kamlesh,

I understand your point and that is what we follow here, however the catalog task is already closed and there are no more tasks pending. Please find the screenshot.

 

Raghesh_0-1667471238218.png

 

 

regards,

Raghesh

AnubhavRitolia
Mega Sage
Mega Sage

Hi @Raghesh 

 

You can right below Fix Script (More recommended than Background Script) to close list of RITMs with code below:

 

var ritm = new GlideRecord('sc_req_item');
ritm.addEncodedQuery("request.numberINRITM0000005,RITM0000004,RITM0000003^active=true^stateNOT IN3,4,7");
ritm.query();

while(ritm.next())
{
ritm.state = 3;
ritm.setWorkflow(false);
ritm.update();
}

 

You can modify the Query in 2nd line based on your requirement.

 

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023

Hi @AnubhavRitolia 

Thank you for the script!

Here we are controlling the RITM using Stages and not with State. So what would be the script look like for updating the Stages.

 

regards,

Raghesh

 

regards,

Raghesh

Hi @Raghesh 

 

Please try below code:

 

var ritm = new GlideRecord('sc_req_item');
ritm.addEncodedQuery("request.numberINRITM0000005,RITM0000004,RITM0000003^active=true^stateNOT IN3,4,7");
ritm.query();

while(ritm.next())
{
ritm.state = 3;
ritm.stage = 'delivery';  // Here 'delivery' is a choice. You can put your choice value which you want to update.
ritm.setWorkflow(false);
ritm.update();

var req = new GlideRecord('sc_request');
req.addQuery('sys_id',ritm.request.sys_id);
req.query();

if(req.next()) {
req.request_state = 'closed_complete';
req.setWorkflow(false);
req.update();
}
}
Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023