So I'm stuck on a situation where I have a parent and a child flow. Parent flow waits for a child flows response. Child flow responds success when child flow run is completed successfully. However, I have an approval process within the child flow that is inside a ApplyToEach(ForEach) loop, and I need to exit this foreach loop. "Terminate" action cannot be used inside a foreach loop. Hence I tried using "CancelFlowRun" action. This works by cancelling the child flow, but the issue is it sends back no response to the parent flow. Parent flow keeps on retrying to start the child flow. Now I have also turned the Retry Policy to "None". Which means parent flow will not retry to start the child flow. But the issue is the parent flow fails due to the fact child flow did not respond because it was cancelled. And we cannot use Respond to flow option or Response HTTP option from child flow within a ForEach loop, this is not allowed.
Is there any suggestion. I do not want to rewrite my entire flow, took a lot of time and effort 😥
Hi @DJ_Jamba ,
So now I have ran into an issue where only maximum of 8 nesting condition is allowed. I cannot use IfThenElse condition anymore inside the ApplyToEach. 😥
Hi @MoshinK786
Declare a boolean variable at the top of your flow with it's default set to false e.g.
In your Apply to each loop, the first action should be a condition to check that StopLoop is false.
After each iteration in your Apply to each loop, add another condition that should determine whether you should continue processing the remaining loop items. If it should not continue, set your variable to true. e.g.