Trigger MS Flow On Condition Based On Column's Value With SharePoint List

In this article, we would learn about how to set conditional trigger point in ms flow based on sharepoint column values.

I was exploring MS Flow and working on an article series for SharePoint based action in flow and I accidentally found something interesting. 
 
On the below trigger, go to Settings windows using the below buttons. Please note that this option is available in all the trigger points and not specific to below one.
 
Trigger MS Flow On Condition Based On Column's Value With SharePoint List
 
I found a new configuration option, i.e., 'Trigger Conditions'. My first thought is that this is something we are waiting for a long time - To specify a trigger condition which can decide whether it should be triggered or not. To my surprise, it was :) 
 
Trigger MS Flow On Condition Based On Column's Value With SharePoint List
 
I tested it immediately and it is working perfectly but it requires knowledge of expressions and we have to type manually. We cannot use dynamic content selection window or expression builder as of now. So, we have to build expression manually. So, this article is to describe how to use these options and see how it works. 
 
Scenario 
 
List Name - Custom  List
Column - Status (choice)
Flow Trigger Point - When an item is created or modified.
 
Use case - Trigger flow only when the Status column is 'Pending' 
 
Click on Add button in the screenshot below 'Trigger Conditions'. Add the below formula.
  1. @equals(triggerBody()?['Status']?['value'],'Pending')  
Trigger MS Flow On Condition Based On Column's Value With SharePoint List
 
Click Save and test the flow by modifying or creating an item in List and set Status column value = 'Pending'.  As this is a choice column, we need to read its actual value by using ['Value'].
 
Trigger MS Flow On Condition Based On Column's Value With SharePoint List
 
I saved it, went to flow run history, and it showed that it ran successfully. 
 
Trigger MS Flow On Condition Based On Column's Value With SharePoint List
 
For getting a better understanding of expressions which can be used here, I will explain some scenarios to give you an idea of how to build formulas for your requirement.
 

Two conditions where both must be true

 
You can simply add multiple expressions like below.
 
Trigger MS Flow On Condition Based On Column's Value With SharePoint List
 

Two conditions where anyone can be true 

 
What if you need to check OR between 2 conditions? Again, here, we cannot do it using 2 expression boxes, We would have to do it utilizing single expression with 'OR' keyword. Let us check if status is pending or ID is 42; then only run the flow. Modify the condition to below.
  1. @or(equals(triggerBody()?['Status']?['Value'],'Pending'), equals(triggerBody()?['ID'],42))  
We can use the combination of And and OR like below. Here, we are checking (if the status is pending or completed) and (ID is 42).
  1. @or(equals(triggerBody()?['Status']?['Value'],'Pending'), equals(triggerBody()?['Status']?['value'],'Completed'))    
  1. @equals(triggerBody()?['ID'],42))    
Trigger MS Flow On Condition Based On Column's Value With SharePoint List
 
Please note that we can use one or more logical expressions inside a single condition for any complex triggering point.  Before this, we used to put condition branch to check value but it still triggers flow and shows in run history. I think this reduces the instance of running flow history by a lot.
 
I am sure we can expect a good UI in the near future and option to select dynamic content and usage of expression builder as we do with actions. 
 
In this article, we have learned how to create MS flow trigger on certain conditions and how to build an expression for the same. 
 
This option is available for all the triggers in MS flow,  it can effectively be used for designing some advanced use cases.