Restarting the Updated Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 08:01 AM
Dear Community,
I have updated a specific catalog item workflow. The new RITMs are following the updated workflow.
How can I restart the workflow with the updated workflow for the previous RITMs. There are almost 18 RITMs that were submitted with the old workflow.
Is there a way to trigger/restart the updated workflow for the existing RITMs?
Regards,
Burhan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 08:37 AM
Hi @Burhan Shah ,
Please check the below post and try it in non-prod instance/environment first, hopefully it will fulfill your requirement.
How to delete and attach a new workflow in the RITM
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2024 06:22 AM - edited 12-07-2024 06:24 AM
Hi @Burhan Shah ,
There are 2 ways to restart workflows.
No code.
- Delete the workflow context record. I do this by going to the record in question. E.g. /sc_req_item.do?sysparm_query=number=RITM0012345
- Click into the "Show Workflow Context" UI Action Link (above the related lists)
- Click Delete on the top right of the workflow context record !!! BE SURE YOU'RE ON THE WF_CONTEXT !!!
- Goto the RITM and update the stage to request_approved
- That's it.
With Code.
- Delete the workflow context record. I do this by going to the record in question. E.g. /sc_req_item.do?sysparm_query=number=RITM0012345
- Click into the "Show Workflow Context" UI Action Link (above the related lists)
- Click Delete on the top right of the workflow context record !!! BE SURE YOU'RE ON THE WF_CONTEXT !!!
- Goto the wf_workflow.list table and find the workflow you want to start, copy it's sys_id.
- Run this script in a background script;
var current = new GlideRecord('sc_req_item');
current.get('number','RITM0012345');
var id = 'cfe7a62f13958340f415345fd144b075';//wf_workflow sys_id here
var w = new Workflow();
var context = w.startFlow(id, current, current.operation(), function(){
var vars = {};
for (var n in current.variables)
vars[n] = current.variables[n];
return vars;
});