My trigger is from Forms for an approval process.
But before I move forward for Approval process i want to exclude some responses on a criteria based on the form. I did that but i was not able to terminate the flow after that. As Terminate control does not work in for-each condition.
Solved! Go to Solution.
Hi @sjehanzeb ,
Terminate action cannot be used inside a for each loop.
Please try if the following workaround will work for you.
Please initialize variables in your flow, outside of the Apply to each loop, add Condition or other actions, then terminate the flow under If yes or If no branch.
Best regards,
Mabel
I also miss this feature, you can vote its implementation here: https://powerusers.microsoft.com/t5/Flow-Ideas/Flow-loop-break/idi-p/166125
Is your loop a do-until? If so, as a potential workaround, have you taken into account the following possibility?
Step#1: DEclare an auxiliary boolean variable 'Stop Loop' with default value to false before the for each control
Step#2: include the evaluation of this new variable in your do-until condition
Step#3: inside your do-until logic, turn to 'Stop Loop' to true whenever you want to stop new iterations
Step#4: just after the do-until, add a condition to evaluate 'Stop Loop'. In the 'true' branch, add a Terminate action block.
Hope this helps
Proud to be a Flownaut!
I am inside the 2nd "For Each" loop. Will it work if i encapsulate the entire flow in "do-until" with a boolean check
Can you share a screenshot with your flow details, so we can get more info on what you are working on, and see if the suggested workaround can be applied on your use case?
Proud to be a Flownaut!
Hi @sjehanzeb ,
Terminate action cannot be used inside a for each loop.
Please try if the following workaround will work for you.
Please initialize variables in your flow, outside of the Apply to each loop, add Condition or other actions, then terminate the flow under If yes or If no branch.
Best regards,
Mabel
This solution also works when you are forced to place an Approval action inside a For Each! If you set the outcome as a variable, you can then use that variable as described above to terminate a rejection. Otherwise, a rejection inside of a For Each will NOT terminate a Flow.
If you are curious as to why I have to place an Approval inside a For Each, I am performing a SQL stored procedure to validate a new form value against a database for existence that creates a dynamic message for the approver inside the Flow message. With the limitations of Flow and SQL connector gateways, I could not find any other way to generate my validation.
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!
User | Count |
---|---|
42 | |
38 | |
37 | |
35 | |
25 |
User | Count |
---|---|
39 | |
36 | |
33 | |
31 | |
26 |