powerautomate

Conditions and Switches inside Power Auromate

Use a condition to specify that a cloud flow performs one or more tasks only if a condition is true or false.

The Switch function evaluates a formula and determines whether the result matches any value in a sequence that you specify. If a match is found, a corresponding value is returned. If no match is found, a default value is returned. In either case, the returned value might be a string to show, a formula to evaluate, or another form of result.

If and Switch are very similar, but you should use the best function for your situation:

In this Lab

In this lab, you will create a cloud flow using a Power Automate to work with conditions and switch functions.

Task 1

a. Create an automated cloud flow called Conditions Demo and the trigger would be When an item is created or modified (SharePoint list)

image

b. Configure the SharePoint trigger:

image

c. Add a new condition - if Priority Value is equal to High OR Priority Value is equal to Medium.

image

d. Add a __Send an Email(v2) action for the True and False Branches:

image

e. Save and Test the flow.

Task 2

a. Modify the condition - if Priority Value is equal to High AND Progress Value is equal to Not started.

image

b. Save and Test the flow.

Task 3

a. Modify the condition - if Progress Value is equal to Blocked AND if Priority Value is equal to High OR Priority Value is equal to Medium

image

b. Save and Test the flow.

Task 4

a. Replace the If condition with a Switch statement of the Priority Value

image

b. e. Save and Test the flow.