cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver I
Resolver I

how to stop a flow if condition fails

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Resolver I
Resolver I

Re: how to stop a flow if condition fails

I got it to work.  Thanks!

View solution in original post

10 REPLIES 10
Highlighted
Community Support
Community Support

Re: how to stop a flow if condition fails

Hi @mwolf222,

 

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:12.JPG

The flow works successfully as below:13.JPG

Within "If/no" branch of Condition, we do nothing.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Dual Super User III
Dual Super User III

Re: how to stop a flow if condition fails

Hi!

There is also a "Terminate" action block

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Resolver I
Resolver I

Re: how to stop a flow if condition fails

I got it to work.  Thanks!

View solution in original post

Highlighted
Regular Visitor

Re: how to stop a flow if condition fails

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). Sceen shot steps that will stop a Flow from running and prevent any further steps from executing.Sceen shot steps that will stop a Flow from running and prevent any further steps from executing.

 

Highlighted
Helper II
Helper II

Re: how to stop a flow if condition fails

Hi 

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""Untitled2.png

Highlighted
Anonymous
Not applicable

Re: how to stop a flow if condition fails

@Hamid - have you come up with a solution? I have the same problem.

Highlighted
Dual Super User III
Dual Super User III

Re: how to stop a flow if condition fails

Hi all

"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.

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Anonymous
Not applicable

Re: how to stop a flow if condition fails

@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?

Highlighted
Dual Super User III
Dual Super User III

Re: how to stop a flow if condition fails

@Anonymous 

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



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Dual Super User III
Dual Super User III

Re: how to stop a flow if condition fails

Hi again

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



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (12,293)