Dec 27, 2022 10:10 PM

JSON Objects as a Switch - Power Automate & Expressions

External YouTube Channel

Complex switches and nested IF statements can be replaced with a simple object and an expression in Power Automate. In this session, learn how you can benefit f

Complex switches and nested IF statements can be replaced with a simple object and an expression in Power Automate. In this session, learn how you can benefit from an understanding of JSON and objects, use an external data source (like a list) to manage your dynamic data in a Flow. See how you can repurpose a list item to an object that can be retrieved from a single key name.

If you are building flows with identical branches in a switch or hitting the switch option limit, use a JSON Object! Using approvals and want dynamic approvers? Use an object created from a List or Dataverse Table.

In this Video

00:00 Intro

00:47 JSON Object Basics

04:28 Using an Object with Microsoft Forms

06:30 Creating a dynamic object from a List

13:17 Using an object with a Power App

17:17 Outtro

If and Switch functions in Power Apps

Determines whether any condition in a set is true (If) or the result of a formula matches any value in a set (Switch) and then returns a result or executes an action.

https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-if

Power Automate Switch

In Microsoft Power Automate (formerly known as Microsoft Flow), the "Switch" action is used to evaluate a series of conditions and execute a specific action or set of actions based on the results of those evaluations. It is similar to an "if-else" statement in programming, where the "Switch" action checks a value against a series of conditions and performs an action based on the first condition that is met.

Here is an example of how the "Switch" action could be used in Power Automate:

The "Switch" action is triggered when a new item is added to a SharePoint list.

The "Switch" action checks the value of a field called "Priority" in the new item.

If the value of "Priority" is "High", the "Switch" action sends an email notification to the team leader.

If the value of "Priority" is "Medium", the "Switch" action sends an email notification to the team member.

If the value of "Priority" is "Low", the "Switch" action does nothing.

You can add multiple conditions to the "Switch" action, and specify different actions to be taken for each condition. You can also use the "Default" option to specify an action to be taken if none of the conditions are met.