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

How to restart for each flow on error Power Automate Desktop

I have a for each action in my power automate desktop flow. I am needing to incorporate an On error on action within the for each action. I am wanting the On Error to restart at the For each action. The On error will be within the Subflow. If it errors out, I want the flow to go back to step 19 and go to the next account number. Thanks for any help with this! 

 

rhawkins10701_0-1651206799487.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
VJR
Super User
Super User

So new lesson learnt today - Variables are of global nature in PAD and Labels are not 😊.

You can use set variable instead.

In the on Error in the subflow, set a variable like varFlag = 1. Depending on how you have designed the subflow you might also have to select "go to end of block"

Then in the Main flow add your "If" in such a way that it bypasses everything and goes to the End statement

 

 

For each 

 

run subflow ("")

If varFlag= 0

 do something

End if

End

 

so If you set varFlag to 1 in Subflow, it will not go inside the IF and directly go to the End which will be your next iteration of the For loop.

View solution in original post

4 REPLIES 4
VJR
Super User
Super User

Hi @rhawkins10701 

Cant see at which line the "End" statement of the For each loop is.

 

Add a Label just before the "End" statement. 

Then in your subflow, the On error has an option called "go to label". So when it encounters an error it will jump to the label which is your next iteration of the For each loop.

 

VJR_0-1651207411030.png

 

 

Hey @VJR ! I created the label but when I go to on error I do not see my created label. Am I doing this wrong? 

 

rhawkins10701_0-1651208045872.png

 

rhawkins10701_1-1651208062311.png

 

I noticed when I use the on error on an action within the subflow it does not show my label. But if I use an action in my main flow I see the label.

VJR
Super User
Super User

So new lesson learnt today - Variables are of global nature in PAD and Labels are not 😊.

You can use set variable instead.

In the on Error in the subflow, set a variable like varFlag = 1. Depending on how you have designed the subflow you might also have to select "go to end of block"

Then in the Main flow add your "If" in such a way that it bypasses everything and goes to the End statement

 

 

For each 

 

run subflow ("")

If varFlag= 0

 do something

End if

End

 

so If you set varFlag to 1 in Subflow, it will not go inside the IF and directly go to the End which will be your next iteration of the For loop.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Top Kudoed Authors
Users online (2,342)