I have a condition in my Flow that puts an email attachment into a SharePoint folder if it has an x in the file name.
The problem is, all attachments end up in the folder! How to I stop a flow from proceeding (putting attachment in the folder) if it fails the condition? I have tried "Stop Flow", but it doesn't work. Thanks!
Solved! Go to Solution.
Could you please share a screenshot of your flow’s configuration?
I have made a test on my side and the flow works well. My flow’s configuration as below:
The flow works successfully as below:
Within "If/no" branch of Condition, we do nothing.
Adding detail to this solution to possibly help someone else--I came across this post when researching, but don't think that I understood or perhaps overlooked this "Terminate" comment.
Using the "Terminate" control task will stop any subsequent Flow tasks from executing. Other methods, e.g. using a Condition check where the error path is set to "do nothing", may still trigger subsequent Flow steps. "Terminate" solves that problem.
Below is a screenshot of steps that will stop a Flow when an error or timeout occurs. Simply adding the "Terminate" control (at bottom of screenshot) will stop the Flow. The additional steps sends an email notification and updates a boolean field that the record needs to be re-submitted at another time (triggered in a different Flow).
I have the same problem. after filtering out the emails based on their subject I put a condition to extract only excel files, but for some reason it extracts all the attachement with different formats. I tried to put the Terminate action if the condition is not met but it says Terminate Action dose not work for "For each attachemnet""
"Terminate" action block can be used inside a condition, but not inside an Apply to Each. I usually add "Terminate" inside one of the branches of a condition, and keep on adding action blocks after the condition blocks.
@efialttes - my condition is inside of Apply to Each and it won't fail if the conditions aren't met since "No" is an option. A "terminate" after that Apply to Each action is pointless. I need it to stop based on the condition inside the Apply to Each. Any ideas?
Maybe a Do Until + an integer variable increasing its value by one.
So, "Do Until" would depend on both there are still items in the array to be read, and we shall not terminate yet the evaluation.
Using a "Do Until" is extremely tricky
Hope this helps
In this post you will find a very very simple example of a Do Until.
Now, imagine you initialize an integer variable 'i' as 0. You also initialize a boolean variable 'exit' as false. Then you enter the loop, inside it:
-inspect the content of the i'th element of the array
-decide if for some reason we shall stop evaluating array items, if so set 'exit' as true;
-finally increment the integer
So, 'until' expression shall stop looping either if 'i' is greater than the length of the array, or if 'exit' is set to true.
If you finally opt to use 'Do until' please be careful with its limits.
Hope this helps
Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.
Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.
The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.