Flow Designer - Iterative Loop

nowitsvashu
Tera Guru

Hi 

I want my flow to be iterative.

suppose State change from in progress to on hold then wait for 10 seconds if it not closed in 10 seconds then it is updated its state again to in progress....

I've completed it...

 

But I want if again the same record when move from in progress to on hold then uses the "same flow execution" how can we configure our flow like it.

2 REPLIES 2

shloke04
Kilo Patron

Hi @nowitsvashu ,

There are multiple ways through which you can do this:

 

Option 1.

 

You can define a flow and have it's trigger condition as "State Changes to Work in Progress" and then within your flow actions you can add the timer and other update record action as you need.

 

Option 2:

Define a Subflow, and trigger that subflow using a BR if you have an existing script for your scenariowhich you need to evaluate. Below will guide you on how to call a subflow from a BR:

 

Sample Script for reference:

(function() {
	
	try {
		var inputs = {};
		inputs['scan_id'] = ; // String 
		inputs['template_instance_id'] = ; // String 
		inputs['application_name'] = ; // String 
		inputs['short_description'] = ; // String 

		// Start Asynchronously: Uncomment to run in background. Code snippet will not have access to outputs.
		// sn_fd.FlowAPI.getRunner().subflow('sn_document_appr_0.application_template__document_approval_template').inBackground().withInputs(inputs).run();
				
		// Execute Synchronously: Run in foreground. Code snippet has access to outputs.
		var result = sn_fd.FlowAPI.getRunner().subflow('sn_document_appr_0.application_template__document_approval_template').inForeground().withInputs(inputs).run();
		var outputs = result.getOutputs();

		// Get Outputs:
		// Note: outputs can only be retrieved when executing synchronously.
		var app_sys_id = outputs['app_sys_id']; // String
		
	} catch (ex) {
		var message = ex.getMessage();
		gs.error(message);
	}
	
})();

 

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Sandeep Rajput
Tera Patron
Tera Patron

@nowitsvashu You will not be able to reuse a a flow context again. The context remains valid till the current execution completes. Once it is over, you need to re-trigger the flow to launch a new context, same one can't be reused.