Flow designer - Restarting a flow

Ni3
Kilo Contributor

Hi All,

Just wondering if anyone has a script that can restart a flow and not trigger approvals.

We have a flow that queries AD through the mids and this sometimes fails for whatever reason. Essentially we just want to give the flow a restart. I know this was possible in the old workflows. Anyone have anything for flow designer?

2 REPLIES 2

Rupali1
Tera Contributor

Hello Ni,

 Please find below link might be it will help you to solve the issue.Please mark helpful it it will really helps you.

 

 

 

https://youtu.be/EPOsxq4O1dE

 

 

Thanks & Regards,

Rupali Bondar,

9082121282

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

not possible to re-run the flow in flow designer

You can delete the context record via background script or from sys_flow_context table.

Also, you can execute the startFlow() API to create a new context of the flow once the executing/errored out flow context is deleted.

Refer below doc for Flow API:

FlowAPI

Sample script for running flow from script

try {
		var inputs = {};
		inputs['current'] = ; // GlideRecord of table:  
		inputs['table_name'] = 'incident';

              // Execute Synchronously: Run in foreground.
              // var timeout = ; //timeout in ms
              //sn_fd.FlowAPI.executeFlow('global.test_flow', inputs, timeout)
              sn_fd.FlowAPI.executeFlow('global.test_flow', inputs);
	} catch (ex) {
		var message = ex.getMessage();
		gs.error(message);
	}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader