com.glide.plan.runners.FlowObjectAPIException: The current execution is in the waiting state

Jamsta1912
Tera Guru

Hello all,

 

I'm running a script to execute a subflow and make use of the output (actually as part of a function in a scripted REST API). I'm using the standard method to run the subflow synchronously (in the foreground) to wait for the output. Here's a code snippet:

 

 

var inputs = {};
inputs['quoteids'] = quoteIds;

var result = sn_fd.FlowAPI.getRunner().subflow('x_canl_circuit_quo.proceed_customer_quote_to_opportunity').inForeground().withInputs(inputs).run();
var outputs = result.getOutputs();

var Orders = outputs['provisioningreqs'] || '';

 

 

I can see from the executions that the subflow runs OK. But the issue is, it has a Wait action in it (just for 2 seconds) and I think it's because of that that when I run the script,  I get this error:

"com.glide.plan.runners.FlowObjectAPIException: The current execution is in the waiting state"

 

It's like FlowAPI does not want to wait for any time at all for the Wait action to finish. I guess it just sees the Wait action and then has a little freak out.

 

Have any of you experienced the same, and know how to deal with it?

 

Thank you

6 REPLIES 6

Tejaswini Cheb1
Tera Contributor

Hi @Dominik9,

 var result = sn_fd.FlowAPI.getRunner().subflow('subflow name').inForeground().withInputs(inputs).run();
 var outputs = result.getOutputs();
            var mac_status = outputs['mac_status'];
            var status = outputs['status'];
this is how i'm trying to get the outputs and i'm calling this script inside a script action but i'm unable to get the outputs.
I'm receiving this error 'com.glide.plan.runners.FlowObjectAPIException: The current execution is in the waiting state' even though the subflow execution is successfully completed.

Hi @Tejaswini Cheb1 

You run the subflow in foreground, which means it is synchronous. As your subflow is in a waiting state, you cannot use the synchronous method to retrieve the outputs, so you need to change 'inForeground' to 'inBackground'. Then you can use the getOutputs method I sent you to retrieve the outputs as soon as the subflow has finished. You probably need to check the state of the related flow context record to see when the subflow has finished and is ready to provide the outputs. So you may can not do that in the same script action but for example with a BR on the flow context table or a flow triggering on the flow context status change.