I was exploring MS Flow and working on a article series for SharePoint based action in flow and I accidentally found something interesting.
On below trigger, Go to settings windows using below buttons.
I found a new configuration option ‘Trigger Conditions’. My first thought, is this something which we are being waiting for long time? To specify trigger condition which can decide whether should be triggerred or not. To my surpise, it was 🙂
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 this options and see how it works.
List Name – Custom List
Column – Status (choice)
Flow Trigger Point – When item is created or modified.
Use case – Trigger flow only when Status column is ‘Pending’
click on Add button in above screenshot below ‘Trigger Conditions’. Add below formula
Click save and Test the flow by modifying or creating item in List and set Status column value = ‘Pending’. As this is choice column we need to read it actual value by using [‘Value’].
Saved it, went to flow run history and it show it ran successfully.
For getting better understanding of expressions which can be used here, I will explain some scenarios to give you idea on how to build formulas for your requirement.
Two conditions where both must be true. You can simply add multiple expression like below.
Two conditions where any one can be true.
What if you need to check OR between 2 condition? Again here we cannot do it using 2 expression box, we would have to do it utilizing sinelg expression with ‘OR’ keyword. Let us check if status is pending or ID is 42 then only run flow. Modify condition to below.
We can use combination of And and OR like below. Here we are checking (if status is pending or completed) and (ID is 42).
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 show in run history. I think this reduce instance of running flow history by a lot.
I am sure we can expect a good UI in near future and option to select dynamic content and usage of expression builder like we do with actions.
In this article we have learned on how to create make ms flow trigger on certain condition and how to build expression for same.
This option is available for all the triggers in ms flow, effectively it can be used for designing some advanced use cases.
(Visited 1,188 times, 1 visits today)