cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
etherjack
Regular Visitor

Initialize variable mid-flow

If I decide I need a new variable halfway through my flow and add the 'Initialize Variable' action, I get a message saying that I can only initialize a variable at the beginning of the flow. That makes sense as it's what I would normally do when writing custom code in C# and PowerShell.

But, based on many of the screenshots I see in posts (on this forum and others), it appears that variables can be initialzed pretty much at any point. Is that the case? Was this perhaps possible is earlier releases but is not any longer?

 

For example: Here's one being initialized as the 3rd step

 

11

1 REPLY 1
Super User
Super User

Re: Initialize variable mid-flow

You can initialize variables only as long as the actions are not nested in apply to each and scopes.

 

You can use Set variables however. So it is a good idea to initialize varibales at the beginning (without setting a value) and then set values later in the flows. 

 

In some situations you may also be able to use the compose actions instead.

 

 

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (8,197)