It is common to use the ‘When an item created or modified’ trigger when creating flows for Microsoft SharePoint with Power Automate to perform some actions based on some conditions. Before the Trigger Conditions were released, we need to write a condition to perform the action after flow runs. As a result, we would have Flows running and spending our quota without delivering any value. Trigger conditions protect us from that.
Using trigger conditions, one can control the flow to execute or not. This also prevents generating unnecessary entries in Run History.
The first thing for us to understand is how the trigger conditions work. Effectively they work in the same way as an expression, whereby we provide it with a function name, some parameters, all done to determine an outcome of TRUE or FALSE.
For example, I need to generate some PDFs based on some values from the SharePoint list. And it should be generated when all values which required in PDF, should be available then this flow is to run to generate PDF.
To achieve this, I have one field in the SharePoint list called “PDF Status” and it has values – “Not Ready”, “Ready to Generate”, “Generated”. When all the fields have proper values in Microsoft SharePoint List (Field values may be updated from another source like Power Apps, Power Automate, etc.) and value for the “PDF Status” has changed to “Ready to Generate” then our flow will run.
The Power Automate trigger condition is a set of conditions that must be met in order for an action to be taken. PATC determine when a workflow will be initiated. The trigger can be based on a specific event, such as when a record is created or updated, or it can be based on a schedule. There are many different types of trigger conditions that can be configured, so you can tailor your workflows to meet your specific needs.
Go to the trigger template “When an item created or modified”, click on the three dots, then click on the settings as shown below:
Once we click on the “Settings”, we will go to the “Settings” for ‘When an item created or modified’ screen as shown below:
Click the image given below
I only want the automation to run if the fieldset to “Ready to Generate”. Therefore, I will use the function “equals” to check its value.
If you are good with writing expressions, then you can just write it straight into the trigger condition. But if you are not so confident or you want to check whether it’s going to work first, then we can keep it simple and use Power Automate to confirm our logic.
Just add Initialize variable action directly beneath the trigger and then use it to write your expression like below:
equals(triggerOutputs()?[‘body/PDFStatus/Value’],’Ready to Generate’)
The Variable needs to be of a type of Boolean so that we can see whether it is going to return true or false. I will trigger my flow from the SharePoint list, first I will set PDF Status as “Not Ready”, and then set it to “Ready to Generate”.
Once I am sure that the expression is working as I want, I can then take the expression and place it into the trigger conditions. The one addition I need is to add the escape character at the start which is the @ symbol. Therefore, my trigger condition will look like below then click on Done.
Once I have set the trigger condition, I can then remove the test variable in the flow. It will only run when it equates to true.
Conclusion: We saw what Trigger Conditions is, the ability to evaluate a value from the trigger which will determine whether the automation will run or not. This is a much more efficient way of doing this rather than doing the check once the automation has started.
The trigger conditions take the format of an expression and must evaluate as either true or false. If it evaluates to true then the automation will run, otherwise, it will ignore the trigger event.
I hope you found this blog useful. Check our Microsoft Power Platform Services.
Written by Priyanka Patel
Priyanka is Senior Software Developer at Evolvous Limited – specialists in Microsoft Technologies.