Power Automate Switch Case [How to Use]

Do you want to know about the switch in Power Automate? In this Power Automate tutorial, I will explain how to use the Power Automate switch case with examples.

Then, I will show you an example of a Power Automate Switch case with multiple values.

Power Automate switch case

Power Automate Switch control allows executing a specific branch of flow action depending on the switch input value passed.

Power Automate switch action finds a match for the switch input value and implements the following switch cases.

Switch CaseStatementFlow ExecutionConclusion
Case 1MatchesYesCase 2 & Case 3 & Default case not executed.
Case 2MatchesYesCase 1 & Case 3 & Default case not executed.
Case 3MatchesYesCase 1& Case 2 & Default case not executed.

Similarly, it continues to check for other cases. But, if none of the cases matches, it will execute the default case. I hope you got it now about the switch in Power Automate.

When to use Power Automate Switch Action?

Generally, the Power Automate switch action is used to handle multiple conditions to execute the different flow actions. It will be a little bit confusing to use nested condition statements.

A Condition control can add only ten rows under that; instead, one can use Switch case action to handle multiple conditions to run the flow more efficiently. Power Automate Switch action adds parallel switch cases for each value.

See also  How to Send Email based on Date in SharePoint list using Power Automate?

How to use Power Automate Switch Case

Here, I will discuss an example of using the Power Automate Switch case with multiple switch input values.

Dive in to know more!

Here, I have created a SharePoint list named ‘Task Details‘ with a few columns, as shown below:

Column NameData Type
Task Title [Title Column]Single line of Text
Task DescriptionMulti lines of Text
Assigned ToPerson or Group column
Task PriorityChoice column – Low, Medium, High & No Priority
Task Start DateDate and Time column
Task DeadlineCalculated column
Task End DateDate and Time column
ManagerPerson or Group column

I have created a Task Deadline [Calculated column] based on the below formula:

Task Deadline = [Task End Date]-2
power automate switch

Example:

I will impose switch input on the SharePoint list column Task Priority Value.

Based on the Task Priority value, the Power Automate switch cases will execute as provided in the table below.

Switch CaseOperatorTask PriorityFlow ExecutionConclusion
Case 1is equal toLowYesCase 2 & Case 3 & Default case not executed.
Case 2is equal toMediumYesCase 1 & Case 3 & Default case not executed.
Case 3is equal toHighYesCase 1 & Case 2 & Default case not executed.
Default CaseOther valuesYesCase 1 & Case 2 & Case 3 not executed.

Follow the below steps to create a Power Automate flow:

1. Open the Power Automate Home page and click + Create, -> select Automated cloud flow. Give flow name, and select trigger when an item is created or modified-> Tap Create.

See also  How to create a Measure based on Slicer in Power BI

Inside the trigger, select Site Address and List Name.

switch power automate

2. Add a Switch control flow action. Provide the below parameter:

  • On: Take Task Priority Value from the dynamic content.

By default, it displays with Add Case icon and Default section.

power automate switch control

Case 1: [Task Priority Value = Low]

Let’s see the first switch case.

Click on + Add case to add the first switch case. Enter the value Low manually inside the parameter.

power automate switch case

Condition:

If the Task Priority Value = Low -> Post a message to the Assigned to user directly about the details of a task.

3. Add a Post message in a chat or channel flow action. Set the required fields:

  • Post as: Select Flow bot from the drop-down.
  • Post In: Choose Chat with Flow bot from the drop-down.
  • Recipient: Take Assigned To from dynamic content.
  • Message: Enter the message.
switch in power automate

After that, click on +Add case to add the second switch case.

Case 2: [Task Priority Value = Medium]

Take the Switch Input value equals Medium manually.

Condition:

If the Task Priority Value = Medium -> It will check if Task EndDate is less than 10 days -> Send a reminder email about the Task end date to the Assigned person.

power automate switch case multiple values

4. Under Case 2, take Condition control flow action, to include the below condition.

Choose ValueOperatorValue
End Dateis less thanaddDays(utcNow(),10)
power automate case condition

5. Next, add Send an email(V2) flow action under True Condition. Configure the details:

  • To: Take Assigned To from the dynamic content
  • Subject: Write a subject line
  • Body: Enter a detailed description of the mail
power automate switch contains

Case 3: [Task Priority Value = High]

See also  Power Apps Column Chart - How to Build it

Enter switch input value equals High manually.

switch case in power automate

6. Add Create a Teams Meeting with required details as shown below:

  • Subject: Take Title from the dynamic content.
  • Message: Select Task Description from dynamic content.
  • Time Zone: Choose the local time zone from the drop-down.
  • Start Time: Take Task Deadline from the drop-down.
  • End Time: Add the below given expression that adds one hour to the Task Deadline.
  • Calendar Id: Select Calendar from the drop-down.
  • Required Attendees: Add Assigned To email from dynamic content.
  • Optional Attendees: Add Manager Email from dynamic content.
switch case power automate

Default Case: [Task Priority Value – No Priority]

If the Task Priority value is No Priority -> Send an email to the Assigned To member about the details of the task.

7. Add Send an email(V2) flow action and configure the below details like To, Subject, and Body.

power automate switch expression

8. Now Save the flow. Test it Manually. Then, create an item in the SharePoint Online list, as shown in the screenshot below:

Power Automate Switch Control Statements, power automate case statement

9. The related switch case will be executed according to the switch input value when the flow runs successfully.

Output: [Case1]

power automate switch multiple values

Output: [Case2]

how to use switch in power automate

Output: [Case3]

power automate switch function

Output: [Default Case]

power automate switch multiple conditions

This is how to use a switch case action in Power Automate to include multiple condition values.

Download the Complete Flow

You can also download the complete flow and use it in your environment.

Conclusion

I hope you understand now everything about the Power Automate Switch and how to use the switch case in Power Automate.

You may also like:

>