Showing results for 
Search instead for 
Did you mean: 

Ability to 'Initialize variable' at any level

"The operation 'Initialize variable' can only be used at top level."




It sometimes makes sense to be able to initialize a variable within a condition.  Otherwise, we have to initialize variables at the start of a flow, and they're not always going to be set - especially in more complicated flows with lots of conditions (especially nested ones).  Can we please change it so that a variable can be initialized at any level in the flow.



Status: New
Regular Visitor

I'm new to Flow, but 100% agree. My first flow has a page and a half of variables. Some used as constants; some used as text buffers that will be built up over the course of the flow; some are counters, incremented in loops.


Compose can create arbitrary objects, but they appear to be read-only. Or at least cannot be used with data actions such as append string action or increment integer


One would have thought that the control activity Scope would at least live up to its name. Alas, you cannot create variables that have scope of only the Scope.


I'm probably missing something, and perhaps should learn how to better leverage Compose. Pointers are appreciated.

New Member

Mid 2020 and this feature is not available. Not sure if this might be considered a bad practice to have a variable initialized for one of your "fork" flows vs initialized at the top for the entire logic app. My thinking is that I have an exception scenario and it happens for 0.01% of runs and only then I need alternative message to be send and I need to initialize those variables, why would I want them initialized every time the app runs, though there is not yet a solid reason to split it into multiple apps.