Citizen Developer
Zeitspanne
explore our new search
Power Automate - Dynamic Variables
Bildquelle: Shutterstock.com
Power Automate
8. Juli 2023 16:00

Power Automate - Dynamic Variables

von HubSite 365 über David Wyatt [MVP]

Senior Staff Engineer - Intelligent Automation Developer

Citizen DeveloperPower AutomateLearning Selection

Let's start with what a dynamic variable is, then why it's so cool. A dynamic variable is when we are able to select the variable based on another variable, i.e

Power Automate is a Microsoft application that allows automation of routine tasks. A key feature in Power Automate is the use of dynamic variables. A dynamic variable allows the selection of a variable based on another variable, essentially, constructing parts of an expression dynamically.

If you want to choose between two values in Power Automate, you can use either the if() expression or Conditions/Switches. However, these options have their limitations. They either limit you to a binary choice or add complexity to the process, especially if the Switch has multiple options.

For example, you can select a variable/action property dynamically. If a variable equals an integer, then use SharePoint Field_Integer; if it is a string, then get SharePoint Field_String.

  • If (equals(variable('var'),'Integer'), outputs('Get_items')?['body/value']?['Field_Integer'], outputs('Get_items')?['body/value']?['Field_String']).
  • With dynamic variables, we could simplify this to outputs('Get_items')?['body/value']?[concat('Field_',variable('var'))].

This essentially means that any property can be set from a variable, further enhancing the versatility and efficiency of Power Automate.


Dynamic Variables in Power Automate

The introduction of dynamic variables in Power Automate has revolutionized the way automation tasks are carried out. By allowing any property to be set from a variable, it eliminates the need for binary choices or complex conditions/switches. This not only simplifies the process but also enhances operational efficiency. The ability to select a variable/action property dynamically opens up a myriad of possibilities for users. With Power Automate, automation tasks have become less tedious and more efficient, fostering a productive work environment.

Read the full article Power Automate - Dynamic Variables

Learn about Power Automate - Dynamic Variables

Power Automate Dynamic Variables allow you to select the variable based on another variable, making it easier to construct parts of an expression. You can use either the if() expression or Conditions/Switches to choose between two values, but this has the drawback of being either too binary or too complex. With Dynamic Variables, you can select a variable/action property dynamically. For example, if a variable = Integer then use SharePoint Field_Integer, if it is String then get SharePoint Field_String. With Dynamic Variables you can do this: outputs('Get_items')?['body/value']?[concat('Field_',variable('var'))]. This allows you to set any property from a variable. outputs('Get_items')?['body/value'].

More links on about Power Automate - Dynamic Variables

Power Automate - Dynamic Variables
3 hours ago — A dynamic variable is when we are able to select the variable based on another variable, i.e. dynamically construct the parts of an expression.
Power Automate dynamic content [Complete tutorial]
Jan 16, 2022 — In Power Automate, the dynamic contents are the kind of variables produced by triggers and actions that are used in the flow. It let the users ...
Handling Dynamic Properties in a Power Automate Flow
Jan 18, 2022 — Caroline Sosebee, Software Engineer, shares step-by-step instructions for adding dynamic data to an object within a Power Automate Flow.
What are Variables in Power Automate, and How to Use ...
May 4, 2023 — Power Automate variables are essential components that enable users to create dynamic and adaptable flows. They can be used to store, modify, ...
Power Automate Dynamic Content Overview
In this tutorial, we'll discuss the Power Automate Dynamic Content, which lets users select field references from previous steps and even write expressions.

Keywords

Power Automate, Dynamic Variables, Expression, If() expression, Conditions/Switches, SharePoint Field_Integer, SharePoint Field_String, Concat(), Variable('var')