cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper II
Helper II

Looking for a workaround in adding the Terminate control with the "successful" option in the "If no" branch

My flow runs well, no problem. However, it bothers me that I get emails telling me that my flow failed which actually means that the condition wasn't met, thus it didn't proceed to the "If yes" branch. I want to be able to add a terminate control with "successfully" terminated so I know that the flow worked as it should have rather than it telling me that it failed. 

 

The reason why I can't add the "terminate" control is because of "Apply to each". Is there a workaround? Here is a screenshot of my flow:

 

oaghaei_0-1607373135070.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Hi @oaghaei 

You can't add terminate inside the apply to each loop.

Follow the below steps.

 

Add a variable outside your apply to each loop. Try the below

 

image.png



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

View solution in original post

14 REPLIES 14
Super User III
Super User III

Hi @oaghaei 

 

Is that the notification email you getting? Generally you only get when flow fails? I did tested a similar IF condition and flow ran successfully. You could try declare a variable outside the loop and set some value inside the no condition. Lets see whether that helps or not.

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Helper II
Helper II

@abm , thank you for your reply. What I get is a summary of all flows that "failed". Technically they didn't, but the flow counts them as such because I can't add the "terminate- cancelled" option. 

oaghaei_0-1607559670103.png

To clarify, the flow does run successfully. That's not the issue. 

 

The issue is that I only want the flow history to say that a flow failed when it truly fails. 

Also, can you give me an example of what you mean by "declaring a variable outside the loop and setting some value inside the no condition"?

 

Hi @oaghaei 

 

Thanks for your reply. What I was thinking is currently you don't have any actions under the No branch. So  is that means when flow gets executed and IF condition doesn't satisfy the Yes condition there is No action steps to execute. Not sure that is triggering as a failure or not. Under the No condition you could set a dummy value, yes that is not going to do any other business logic but at least flow will execute always an action for the NO conditions hence I suggested the variable technique.



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Helper II
Helper II

@abm , I think I understand where you are going with it, but I don't know what a dummy variable would look like. Would you be able to provide a screenshot of what that would look like?

Yes, I don't have anything in the NO branch because it wasn't allowing me to add the terminate function. This is what it tells me when I attempt to add the terminate function. 

oaghaei_0-1607561197897.png

 

Super User III
Super User III

Hi @oaghaei 

You can't add terminate inside the apply to each loop.

Follow the below steps.

 

Add a variable outside your apply to each loop. Try the below

 

image.png



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

View solution in original post

Helper II
Helper II

@abm doesn't seem to let me:

oaghaei_0-1607561604687.png

 

Hi @oaghaei 

 

Look carefully what I suggested under the No. It's called Set Variable. Not initialise again. You already initialised the variable. Search for Set Variable.

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

@abm oh!! Thanks for your patience! I'll update my flow and will do some testing and will let you know how it goes.

Helper II
Helper II

@abm Looks like maybe something else is missing?

Here is one flow in which I initialized a dummy variable:

oaghaei_0-1608058585682.png

and another one:

oaghaei_1-1608058857866.png

 

 

Super User III
Super User III

I think you are looking at this the wrong way. There is nothing wrong with having nothing in the "No" branch and that will not trigger a failure.

I think you are actually experiencing a failure. Most probably in your condition, more than likely in the date comparison. If not it will be in the subsequent apply to each.

You believe it is working because the initial iterations of the loop ARE working, but I suspect some are not. I would add a compose step right before your condition which contains the value on the left side of your condition, then when you get a failure it will be obvious why it occurred (most likely an invalid comparison).

 

If you do want to put something in the no branch, you can simply put a compose in there with a random string like "no branch was selected". It won't actually do anything, but it might help your troubleshooting 

Hi @oaghaei 

 

Where is your set variable? I can't see from the screenshot. 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

@abm : 

Here I have initialized the variable:

oaghaei_1-1608418251807.png

and here I set the variable (in the no branch): 

oaghaei_2-1608418282223.png

 

 

 

@abm Nevermind, I think that fixed it! I just need to wait to see if I would get those summary emails with failed flows 😄 

Thank you for your time!

Indeed, there were two issues with the flow. Thank you for helping me think through them!

Helpful resources

Announcements
New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (47,312)