Trigger Power Automate (Flow) based on condition in SharePoint Online

Why Power Automate Trigger Conditions are Crucial for Effective Automation (30 Examples)

2 comments

Loading

In this article on conditional Power Automate trigger conditions, we will learn how to trigger a Power Automate flow conditionally (based on certain conditions) in the SharePoint Online list.

Table of Contents

Key-Highlights: Conditional trigger power automate (Power Automate Trigger Conditions)

  • Introduction – benefits of conditional trigger in Power Automate
  • Demo – how to trigger a Power Automate with the conditioning step by step?
  • How to configure the conditional trigger in Power Automate?
  • Various Expression in Power Automate Trigger condition
  • Various configurations in Power Automate (Flow) trigger
  • Verify the conditional triggering in Power Automate from the SharePoint Online list – positive testing
  • Verify the conditional triggering in Power Automate from the SharePoint Online list – negative testing

Introduction – benefits of conditional trigger in Power Automate

The trigger conditions in Power Automate (Microsoft Flow) were a great addition released in mid-2019. Prior to this being released, the flow (Power Automate) would run every time whenever any items were added or created based on the trigger action template you select (on item creation or modification) – then, inside the Power Automate (flow) we had to add if condition to control the execution of subsequent actions or flows down the line. This costs an extra burden or licensing in terms of executing the number flow per tenant for a certain period. Now, after this release – the power automate will not get triggered until a certain condition is met true. So, before coming to the particular Power Automate we have the option to check the trigger condition. In the world of workflow automation, the other counterpart big-name “Nintex” has had this conditional trigger option to configure, in this perspective, the Power Automate lagged in comparison to the Nintex workflow.

Demo – how to trigger a Power Automate with the conditioning step by step (Conditional trigger power automate)?

As part of the demo, below is the employee list structure where one of the columns is “IsADUser” with the (Yes/No) type – in this demo, we will see if “IsADUser” is “Yes” then only the Power Automate should get triggered, otherwise not, now let’s begin with this step by step.

Conditional trigger power automate, trigger Power Automate conditionally - list structure
Trigger Power Automate conditionally – list structure

I have created a test Power Automate named “Conditional Flow Trigger Test”.

And below are the configuration of the Power Automate.

Conditional trigger power automate, when an item is created or modified - Conditional Flow Trigger
When an item is created or modified – The conditional Flow Trigger

In the above Power Automate, I have selected the trigger template as “When an item is created or modified”, then created a variable named “var_IsFlow_Triggered_Check” with a boolean type whose default value is set to false, once the Power Automate gets executed successfully this boolean “var_IsFlow_Triggered_Check” variable will be set to “true”.

Power Automate Triggers – how to configure the conditional trigger in Power Automate?

Go to the first trigger template “When an item is created or modified”, click on the three dots, then click on the settings as shown below:

Conditional trigger power automate, power Automate conditional trigger settings
Power Automate conditional trigger settings

Once we click on the “Settings”, we will go to the “Settings for ‘When an item is created or modified'” screen as shown below:

Conditional trigger power automate, trigger Conditions - Specify one or more expressions which must be true for the trigger to fire
Trigger Conditions – Specify one or more expressions that must be true for the trigger to fire

By default, Split On will be in disabled mode, make it enable. Once we enable the split on we can see that @triggerBody()?[]’value’] is displayed in the array dropdown list.

Conditional trigger power automate, split On - Split On Enable split-on to start an instance of the workflow per item in the selected array. Each instance can also have a distinct tracking id
Split On Enable split-on to start an instance of the workflow per item in the selected array. Each instance can also have a distinct tracking id

Then go to the “Trigger Conditions” section located at the bottom of the screen.

Trigger Conditions to Specify one or more expressions which must be true for the trigger to fire
Trigger Conditions to Specify one or more expressions that must be true for the trigger to fire

Click on the “+ Add” button shown above.

Add the below trigger condition to the box.

@equals(triggerBody()?['IsADUser'],True)

 

Trigger Conditions - equal triggerBody, conditional trigger power automate
Trigger Conditions – equal triggerBody

Then click on the “Done” button.

Notes:

  • The above trigger condition is checking if “IsADUser” is equal to “Yes” for a certain item in the SharePoint list, then this will get triggered for that item.
  • In the above expression “True” shouldn’t be in lower case i.e. instead of “True” if we write “true” it won’t trigger, I have experienced this.
  • The general rule of thumb is – in order to trigger the PowerAutomate, the expression outcome must be a “True“.
  • In the above example, I have used the “When an item is created or modified” trigger action, however the conditional trigger configuration in all the trigger actions like  “When an item is created in SharePoint list” or “When an existing item is modified in SharePoint list”.
  • Apart from the “Split On” and “Trigger Conditions” configurations we can keep the rest of the configurations as is.
  • We can add multiple trigger conditions by clicking on the “+ Add button“.

Various Expression in Power Automate Trigger condition (Conditional trigger power automate)

Expression Result Type Valid Condition
@add(1, 0)

 

Integer No
@true

 

Boolean Yes
@equals(1, 1)

 

Boolean Yes
@json(triggerBody()) Object No

Various configurations in Power Automate (Flow) trigger (conditional trigger power automate)

Though the “Split On” and “Trigger Conditions” are sufficient to run the conditional Power Automate (flow).

For our own knowledge, we should know about the rest of the configurations, so let’s know about those configurations.

Custom Tracking Id:

Set the tracking id for the run. For split-on, this tracking id is for the initiating request.

Custom Tracking ID configuration in Power Automate, Conditional trigger power automate
Custom Tracking ID configuration in Power Automate

Secure Inputs (Preview)

Secure inputs of the operation.
Secure Inputs – Enable/Disable Toggle

Select Input Preview configuration in Power Automate (Microsoft Flow)
Select Input Preview configuration in Power Automate (Microsoft Flow)

Retry Policy

A retry policy applies to intermittent failures, characterized as HTTP status codes 408, 429, and 5xx, in addition to any connectivity exceptions. The default is an exponential interval policy set to retry 4 times. The retry policy can be selected as one of the below choices:

  • Default
  • None
  • Exponential Interval
  • Fixed Interval
Retry policy configuration in Microsoft Power Automate, conditional trigger power automate
Retry policy configuration in Microsoft Power Automate

Concurrency Control

Limit the number of concurrent runs of the flow, or leave it off to run as many as possible at the same time.
Concurrency control changes the way new runs are queued. It cannot be undone once enabled.

Limit – Enable/Disable Toggle

Concurrency Control configuration in Power Automate (Microsoft Flow), conditional trigger power automate
Concurrency Control configuration in Power Automate (Microsoft Flow)

Conditional trigger power automate – verify the conditional triggering SharePoint Online list – Positive testing

Go to the “Employee” list and for an item change the “IsADUser” value to “Yes” from “No”.

Trigger Power Automate based on condition from SharePoint Online list
Trigger Power Automate based on the condition from the SharePoint Online list

Now, the Power Automate , should be triggered.

Go to the “28-day run history” of the Power Automate log report, we can see that a few minutes ago, the Power Automate (Microsoft Flow) ran successfully.

 

Conditional trigger power automate, 28-day run history - Power Automate
28-day run history – Power Automate

Now, click on the “Oct 31, 8:06 AM (6 min ago)” link from the above report.

In the next screen, we can see the message – “Your flow ran successfully” with all green ticked which confirmed all the actions in the flow have been executed successfully.

Conditional trigger power automate, your flow ran successfully message from Power Automate log
Your flow ran successfully message from Power Automate log

By now we have tested the positive scenario that is when the “IsADUser” value is set to “Yes” in the SharePoint Online list for the configured site and list (Employee), the flow should get triggered, and we have seen this worked.

Conditional trigger power automate – Verify the conditional triggering SharePoint Online list – negative testing

In this section, we will perform the negative testing that is we will set the “IsADUser” value to “No” again for the same item in the SharePoint list, and this time the flow should not get triggered as the trigger condition will fail.

Conditional trigger power automate, trigger flow conditionally from SharePoint Online list - negative testing
Trigger flow conditionally from SharePoint Online list – negative testing

Now, if we go to the “28-day run history” report, we can see that the flow didn’t get triggered as the condition was not met true (“IsADUser”=No).

 

Trigger flow conditionally from SharePoint Online list - negative testing Power Automate Log Report
Trigger flow conditionally from SharePoint Online list – negative testing Power Automate Log Report

Power Automate Conditional Trigger Examples

In the below section we will learn how to handle conditional triggers in Power Automate with the different types of columns and multiple AND or OR conditions.

Power Automate trigger condition with choice column equals condition

Handling the choice column condition in Power Automate conditional trigger is quite different than the Single Line of Text column. Use the below condition for the choice column value-based trigger:


@equals(triggerOutputs()?['body/Client/Value'], 'UK')

Explanation:

In the above formula, the “Client” is a choice type of column in the SharePoint Online list, it has choice values like USA, UK, India, Australia, etc. The flow will trigger if only the Client column value is equal to the UK otherwise not.

Power Automate trigger conditions with equals and text column

Use the below condition to trigger the flow if


@equals(triggerBody()?['Title'], 'SharePoint')

Explanation:

The flow will trigger if only the Title column value is equal to SharePoint otherwise not.

Power Automate trigger conditions with not equals and text column

Use the below condition if you want to check the not equal condition in your trigger condition


@not(equals(triggerBody()?['Title'], 'SharePoint'))

Explanation:

The flow will trigger if only the Title column value is not equal to SharePoint – other ways, the flow will trigger for any values except SharePoint.

Power Automate trigger conditions with contains and text column

Use the below condition if you want to check the contains value in a text.


@contains(triggerBody()?['Title'], 'SharePoint')

Explanation:

The flow will trigger if only the Title column value contains SharePoint otherwise not.

Power Automate trigger conditions with AND

Like any other programming language, in Power Automate we can have multiple ‘AND’ and ‘OR’ operators to check the condition.

The syntax of the AND operator is:


@and(condition1, condition2, condition3,...)

Example:


@and(equals(triggerOutputs()?['body/Client/Value'], 'UK'),equals(triggerBody()?['Title'],'SharePoint'))

Notes:

  • In the above formula, the “Client” (choice type) and “Title” (Text) are two columns.
  • The flow will only trigger if the Client is equal to ‘UK’ and the Title is equal to ‘SharePoint otherwise not.

Power Automate trigger conditions with OR

We can apply multiple OR conditions even in the conditional trigger of Power Automate.

Syntax:


@or(condition1, condition2, condition3,...)

Example:


@or(equals(triggerOutputs()?['body/Client/Value'], 'UK'),equals(triggerBody()?['Title'],'SharePoint'))

Notes:

  • If the Client choice column value is equal to ‘UK’ OR Title column value is equal to ‘SharePoint’ then only the flow will trigger.

Power Automate trigger conditions with the AND OR

We also can add multiple AND OR conditions together.

For example, if we want to trigger the flow, when

  • The Title is equal to SharePoint and the client is equal to UK OR
  • The “ProjectStatus” is equal to “In Progress”, then only the flow should trigger.

For the above scenario, the flow condition:


@or(and(equals(triggerOutputs()?['body/Client/Value'], 'UK'),equals(triggerBody()?['Title'],'SharePoint')),equals(triggerOutputs()?['body/ProjectStatus/Value'], 'In Progress'))

Notes:

  • In the above formula, the Client and ProjectStatus are the choice type of columns and Title is the single line of the Text column.

Power Automate trigger conditions with the greater than or equals condition

Let’s say you have an Employee list where one of the columns is ‘YearofExperience’, and you want to trigger the flow only when experience is entered greater than or equal to 5. Then we can use the below formula:


@greaterOrEquals(triggerBody()?['YearofExperience'],5)

Note:

  • In the above formula, the ‘YearofExperience’ is the number type of column in the SharePoint list.

Power Automate trigger conditions with less than

Use the below formula, if you want to trigger a flow only when the ‘YearofExperience’ is entered less than 5:

 @less(triggerBody()?['YearofExperience'],5) 

Power Automate trigger conditions empty – check empty value in Power Automate

Using the empty function in Power Automate we can check the empty condition. Lets’s say if the “ProjectDetails” column value is empty then only trigger the flow otherwise not. For this, use the below formula:

@empty(triggerBody()?['ProjectDetails']) 

Power Automate trigger conditions not empty – check not empty value in Power Automate

In the opposite way of the above example, let’s say if the “ProjectDetails” column value is not empty then only triggers the flow otherwise not. For this, use the below formula:

@not(empty(triggerBody()?['ProjectDetails']))

Power Automate trigger conditions not empty and empty – with Date Column

The way we have seen how to check empty and not empty for the text column, we can check the empty and not empty condition for the date column as well.

Not Empty condition with the date type column:

For example, trigger the flow only when, if the “ProjectStartDate” is not empty – then use the flow formula:

@not(empty(triggerBody()?['ProjectStartDate']))

Empty condition with the date type column:

For example, trigger the flow only when, if the “ProjectStartDate” is empty – then use the flow formula:

@not(empty(triggerBody()?['ProjectStartDate']))

Summary: Conditional trigger power automate (Power Automate Trigger Conditions)

Thus, in this article, we have learned about how to trigger a Power Automate (Microsoft Flow) conditionally that is based on certain value changes in the SharePoint Online list. We can summarize the learning as below:

  • Introduction – benefits of conditional trigger in Power Automate
  • Demo – how to trigger a Power Automate with the conditioning step by step?
  • How to configure the conditional trigger in Power Automate?
  • Various Expression in Power Automate Trigger condition
  • Various configurations in Power Automate (Flow) trigger
  • Verify the conditional triggering in Power Automate from the SharePoint Online list – positive testing
  • Verify the conditional triggering in Power Automate from the SharePoint Online list – negative testing

See Also: Conditional trigger Power automate (Trigger Conditions in Power Automate)

You may also like the below Power Automate tutorials:

We hope you have enjoyed reading this article and helped you. If you would like to appreciate our efforts or if you have a better solution or a different opinion, please write to the below comment section and do share this with your friends and colleagues. 🙂

 

About Post Author

2 comments on “Why Power Automate Trigger Conditions are Crucial for Effective Automation (30 Examples)”

Do you have a better solution or question on this topic? Please leave a comment