How to restart a workflow from the scratch?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2019 01:10 AM
Hi,
I have a scenario where few RITMs are cancelled without getting approval within the time specified. No tasks were generated so far. Now the requester wants us to open the same RITM again and re initiate the workflow. Is it possible the Restart the workflow from the scratch?
Regards,
Gowdash

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2019 01:16 AM
HI,
Yes it is possible to restart the workflow again.
You can use below code:
new Workflow().restartWorkflow(current, true);
current will be GlideRecord for you RITM.
Check: https://community.servicenow.com/community?id=community_question&sys_id=c18ff2e9db58dbc01dcaf3231f9619c2
Thanks,
Ashutosh Munot

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2019 06:02 AM
Hi,
Use below script in background script, update record sys_id in script:
var ritm = new GlideRecord("sc_req_item");
if(ritm.get("<sys_id of RITM>")){
new WorkflowApprovalUtils().cancelAll(ritm , "<comment if any>");
new Workflow().restartWorkflow(ritm);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2019
06:16 AM
- last edited on
‎01-30-2024
04:59 PM
by
ServiceNow
Hi,
Add global as below :
global.Workflow().restartWorkflow(current, true);
Refer to Pradip Sharma's reply in following community thread.
Restart workflow from UI action?
Regards,
Ajay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2019 01:54 AM
Hi,
Yes, you can restart the workflow.
Use this in script:
new global.Workflow().restartWorkflow(current, true);
Thanks