This Power Automate tutorial will explain what a switch case is in Power Automate. We will also look about Power Automate Switch case Multiple circumstances with an example.

Power Automate Switch Case Overview

A Switch case action in Power Automate is a control function that allows for expression or variable to change the flow behaviour. Where the switch case has multiple cases, each of which has a different action or statement block.

The Power Automate switch block is made up of three major components:

  The switch action in Microsoft flow indicates the start of the switch block. In contrast, each switch has an end action that signals the completion of the switch block.
  If the condition is satisfied or true, each case will then execute a block of code within the switch block.

  If the condition is not met, the flow will proceed to the default case block, if any.

Power Automate Switch Case Expression

Here, we’ll look at how to use power automate to automate if the switch case value is null.
I have created a list in SharePoint Online i.e. switch practice. In which choice field i.e. Technology.
So when a user adds the information, according to the Technology the flow will switch automatically.

When a user select the Technology from choice, Power automate will automatically populate the same value to the previous technology.

Create a flow in Power Automate

Now we will create a flow that will update items in the SharePoint list.

Log in to Power Automate, then click on Create -> Automated Cloud flow.

Next, give the flow name, and then choose ‘When an item is created’ trigger. Then select Create.

Provide the site address and list.

Switch between Multiple values

Here we have 3 choices in the Technology column, so we will create 3 cases based on a single control. The Technology column contains 3 values i.e. Python, Sql, MongoDB.

So, if the first case is true, it will run the first case; otherwise, it will check the second case; if the second case is true, it will run; otherwise, it will check the third case, and so on.

So, for this, click the Next step button and then select the switch control.

Now we will set the value in which the switch will on or run if the value will not pass then the switch will not run.

So, here we will set the value as Technology value

Then set the case1 for Python value

Now if the case for Python return false, next in case 2 set the value for Sql. Then if this case for Sql is true then update the item For Sql.

At last, if the case for Sql is false then it will run the case for MongoDB.

Add a trigger

After you save the flow, you will see the warning, is Popped by Power Automate, because the flow’s update item action will update the item, and as soon as the item is updated, the flow will be triggered again.

For each update item action, it will show the warning.

So to stop this infinite loop trigger we will add a trigger condition i.e when the Technology field value is not equal to the previous technology field value, then only the flow will trigger.

Click on the more icon in ‘when an item is created or modified’, then click on Setting.

  1. Scroll down to trigger condition, then click on Add icon to add the trigger condition.
  2. Then add the below trigger condition. Click on Done.

@not(equals(triggerBody()?[‘Technology’]?[‘Value’], triggerOutputs()?[‘body/PreviousTechnology’]))

Final Step

Now add an item in the SharePoint list to trigger the flow and while adding value leave the previous technology box that will assign automatically.

So now you can see the previous Technology is assigned automatically.

Also, we can check the flow in Power automate, as the Technology value is MongoDB, so we can check the case for MongoDB.