- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2022 01:45 AM
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
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2022 06:53 AM
Hi @Raghesh
My Mistake.
Please put Request Numbers on 2nd line instead of RITM numbers.
Or just use number instead of request.number.
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2022 03:00 AM
@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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2022 03:27 AM
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.
regards,
Raghesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2022 02:52 AM
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.
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2022 04:44 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2022 05:35 AM
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();
}
}
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023