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 Case | Statement | Flow Execution | Conclusion |
Case 1 | Matches | Yes | Case 2 & Case 3 & Default case not executed. |
Case 2 | Matches | Yes | Case 1 & Case 3 & Default case not executed. |
Case 3 | Matches | Yes | Case 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.
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 Name | Data Type |
Task Title [Title Column] | Single line of Text |
Task Description | Multi lines of Text |
Assigned To | Person or Group column |
Task Priority | Choice column – Low, Medium, High & No Priority |
Task Start Date | Date and Time column |
Task Deadline | Calculated column |
Task End Date | Date and Time column |
Manager | Person or Group column |
I have created a Task Deadline [Calculated column] based on the below formula:
Task Deadline = [Task End Date]-2
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 Case | Operator | Task Priority | Flow Execution | Conclusion |
Case 1 | is equal to | Low | Yes | Case 2 & Case 3 & Default case not executed. |
Case 2 | is equal to | Medium | Yes | Case 1 & Case 3 & Default case not executed. |
Case 3 | is equal to | High | Yes | Case 1 & Case 2 & Default case not executed. |
Default Case | – | Other values | Yes | Case 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.
Inside the trigger, select Site Address and List Name.
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.
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.
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.
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.
4. Under Case 2, take Condition control flow action, to include the below condition.
Choose Value | Operator | Value |
End Date | is less than | addDays(utcNow(),10) |
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
Case 3: [Task Priority Value = High]
Enter switch input value equals High manually.
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.
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.
8. Now Save the flow. Test it Manually. Then, create an item in the SharePoint Online list, as shown in the screenshot below:
9. The related switch case will be executed according to the switch input value when the flow runs successfully.
Output: [Case1]
Output: [Case2]
Output: [Case3]
Output: [Default Case]
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:
- Add Members to Microsoft Teams using Power Automate
- Power Automate Trigger Conditions Examples
- Power Automate Update SharePoint list item
- How to Change Trigger in Power Automate
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.