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

Variables in parallel branches

Hi

I have an Approval flow which captures data from a PowerApp screen then kicks of a parallel approval for each person selected. All this works fine. I had an issue that if the document being reviewed is open the flow fails. I've since added a retry block which captures the error, extracts the email address of the person from the error message and send an email to that person asking them to release the doc. The flow waits and retries the update. Again this works fine. I developed this for one person with the view to replicate the retry block across the other parallel branches. I have potentially 10 branches which could be processing an approval. My questions are:

  1. Can i have the retry block once to cover any error that might occur across the 10 parallel branches or do i have to apply the block to each branch individually? - In a traditional programming language you define retry block once and its called from anywhere within the program
  2. Are there any ways to initialise variables just before i need to use them? at the moment they are all defined at the top of the flow and i might not ever use them!

Thanks for any insights!

cheers!

dj

1 ACCEPTED SOLUTION

Accepted Solutions
Paulie78
Super User
Super User

  1. You cannot have it only once. To do that you'd have to put it in a separate flow and call that.
  2. Nope, variables can only be initialised outside of a loop.

Having said the above. You could use an apply-each with concurrency and avoid the requirement of a variable. This is something I do often now and it works well.

View solution in original post

2 REPLIES 2
Paulie78
Super User
Super User

  1. You cannot have it only once. To do that you'd have to put it in a separate flow and call that.
  2. Nope, variables can only be initialised outside of a loop.

Having said the above. You could use an apply-each with concurrency and avoid the requirement of a variable. This is something I do often now and it works well.

Hi

Thanks for your quick response!

I'm fairly new to Power Automate, do you have a simply example of calling another flow? If i created a separate flow which initialised all the variables and called that at the start of my main flow, all those variable will be in scope?

Re your point 2, When i've attempted to initialise a variable in a condition branch it throws an error and i have to initialise it at the top level of the flow.

Cheers!

dj 

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.

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.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (2,490)