How to Refresh a Failed Flow after resolving error

lakshmi2002
Tera Contributor

 

Hi All,

I encountered an issue in a Flow Designer flow where the execution failed while attempting to create a record due to a "Create" ACL restriction on the target table.

The ACL has now been updated to grant the required create access to all users.

Could you please suggest how to resume or refresh the same Flow execution context so that it continues from where it failed? Specifically, is there a way to achieve this using a background script or fix script?


Could you please suggest a solution for it.

Thank you,

 

3 REPLIES 3

Rocky14
Tera Contributor

@lakshmi2002 

 

Run this in background script or create a fix script, it will restart the flow again but not failed step alone.

 

var contextId = 'flow_Sys_Id';

var gr = new GlideRecord('sys_flow_context');
if (gr.get(contextId)) {

gs.info('Retrying Flow Context: ' + gr.name);

sn_fd.FlowAPI.restartFlow(gr.sys_id);

}

 


If the response helped address your question, please mark it as Helpful and Accept it as the Solution.

Mark Manders
Giga Patron

It already ended in error. You will need to run through the flow again. You could also use the 'test' functionality of the flow to trigger it again, without the need of the trigger.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Tanushree Maiti
Kilo Patron

Hi @lakshmi2002 

Resuming a failed Flow Designer execution in ServiceNow from the exact step where it stopped is generally not supported OOB for standard failures.

 

You can re-trigger a flow  using startFlow() API to create a new context of the flow .

Refer: KB0855865 How to rerun flow designer? 

 

Sample code: https://www.servicenow.com/docs/r/xanadu/api-reference/server-api-reference/ScriptableFlowAPI.html

 

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);
	}

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: