cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mike2500
Level 8

Errors in loops are eaten

Steps to reproduce:

 

Create a flow with a do until loop, and an approval task in the loop. Use a dynamic field as the "assigned to". If the assigned to field has an appropriate value, the flow should work fine. If the assigned to field is empty, the action will fail, but the loop will continue executing. I expected the entire flow to fail, as it normally does when encountering an exception.

4 REPLIES 4
Community Support Team
Community Support Team

Re: Errors in loops are eaten

Hi @Mike2500,

 

Could you please share a screenshot of the configuration of your flow?

 

I have made a test on my side, if the assigned to field is empty, the flow would continue to run until the Do Until is finished, and when the Do Until is finished, we could see the error message inside the each loop in the Do Until.

 

Do you want your flow would fail immediately in the loop if the assigned to field is empty?

If yes, I afriad that you couldn't achieve your requirement in microsoft flow currently, because the Do Until would continue run until it is finished event if one loop has run failed.

 

Best regards,

Alice

 

Mike2500
Level 8

Re: Errors in loops are eaten

As you can see below, in the loop, an email is sent, followed by an approval, followed by another email. In this case, I ran it without a value in the approver field, so the approval step was guaranteed to fail. Note that the follow-up email that is after the approval was never sent. This makes sense, as the approval action failed, and so that action was not reached. However, the loop kept looping, despite the failure. The end result is that over a several minute period, I received 60 emails (from the first send an email action in the loop). Apparently, after 60, the system decided to cut it off. Curiously, the error message doesn't say anything about hitting a maximum number of loops, but rather states: "The request failed. Error code: 'InvalidApprovalCreateRequestAssignedToMissing'. Error Message: 'Required field 'assignedTo' is missing, empty, or contained no valid users.'."

 

Again, I would expect the flow to fail and stop executing, like it does when there is no loop. Or, I would expect a set of options for the loop that would allow me to select a behavior for when there's an error.  But simply having the loop try to execute 60 times in a row is unwanted, and could result in a huge problems if business users are suddenly spammed with 60 emails.

 

 

error with loop.png

Mike2500
Level 8

Re: Errors in loops are eaten

One quick addition: in this case, the condition that will exit the loop is if the item is approved, which would seem to be a common business scenario.

Community Support Team
Community Support Team

Re: Errors in loops are eaten

Hi @Mike2500,

 

The Do Until would continue run until it is finished event if one loop has run failed in microsoft flow currently.

 

If you want the Do Until would run failed immediately when one loop has run failed, you could submit an idea to Microsoft flow Idea Forum:

https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

 

Best regards,

Alice

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,852)