Power Automate Variables Function Explained

Power Automate Variables Function 1

The Power Automate Variables function returns the value of the given variable that is passed to the function by its variable name.

In this article, I’ll introduce you to the variables function and will provide a step-by-step guide on how to use the function in a Microsoft flow.

Power Automate Variables Function

power automate variables expression
variables expression in Power Automate

Return the value of a variable by providing its name as input parameter.

Syntax

variables('<variableName>')

Input parameters

  • variableName (mandatory): The variable name of the variable whose value should be returned.

Return value

  • Returns the value of the given variable.

Power Automate Variables Expression Example

variables('myVar') // if myVar = 'John'
=> 'John'

How To Use The Power Automate Variables Function

Follow the steps to use the Power Automate Variables function in a flow.

  1. Create a new flow with trigger ‘Manually trigger a flow’

    Power Automate Variables Function new flow

    New flow

  2. Add a new step by clicking on ‘+ New step’

    Power Automate Variables Function new step

    Add a new step

  3. Search for ‘initialize’ and click on ‘Initialize variable’

    Power Automate Variables Function initialize variable

    Add Initialize variable action

  4. Setup Initialize variable: 1) Provide a name, 2) select type String, 3) Set value to ‘Hello!’

    Power Automate Variables Function setup variable

    Setup variable

  5. Add a compose step by searching for ‘compose’ and clicking on ‘Compose’

    Power Automate Variables Function add compose step

    Add Compose action

  6. Setup compose action: 1) click into Inputs (popup appears), 2) click on ‘Expression’, 3) set expression to ‘variables(‘myVar’)’ 4) click on ‘OK’

    Power Automate Variables Function add compose step 1

    Setup variables expression in Power Automate

  7. Save and do a test run

    Power Automate Variables

    Result test run – Power Automate variables function example

Leave a Comment

Your email address will not be published. Required fields are marked *