Showing results for 
Search instead for 
Did you mean: 
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




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

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

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 (52,498)