Windows Azure Logic Apps now have support for variables inside a logic app!

 

In order to use them, just search for Variables inside the Add Action dialog box.

You have two options:  one to initialize a variable and one to increment a variable.

Currently, Variables support Integer and Float variable types as shown in the image below.  But with all things Logic Apps, this could change later on.

 

Logic Apps Variables
Logic Apps Variable Options - Integer and Float
Logic Apps Set Variable

You can also use Math Functions when assigning and incrementing variables.

An example of this is using the Add internal function to add 5 to another existing variable.  This would look like this:

@add(variables(‘TestingVariables’),5)

You access a variable inside JSON like

@variables(‘<Variable Name>’)

One interesting point to note if that you can not use the output of a variable as the increment for the same variable.

You will get this error when you try to save the Logic App:

Failed to save logic app TestVariables. The inputs of workflow run action ‘Increment_variable’ of type ‘IncrementVariable’ are not valid. Self reference is not supported when updating the value of variable ‘Increment_variable’.
Whats next for Logic App variables

What would you like to see next for variables in Azure Logic Apps?

  • More data types?
  • Cross Logic App variable support?
  • Ability to create more than one variable at a time?
  • More options than just increment and create?