Well! we all write a lot of Flows in our project with triggers and then check for certain conditions, if it meets well and good, if not , we either terminate it or do nothing. But the fact is the flow still runs & is counted as an API call. When it goes to the actual Production with real-time number of runs, often we have seen that the flows are running and spending the quota very quickly. This is because of the unnecessary runs which are triggering without delivering any value . Trigger conditions protect us from that.
Trigger Conditions are basically like expressions to determine an outcome of TRUE or FALSE which will decide that whether the flow would be triggered or not !?
For example, Remember the example we took of creating Email from Case record. Here we chose the Trigger as “When a row is added” and then checked whether the regarding type of entity is incident. Well in this case the flow is triggered every time an Email was created irrespective of whether it was created from an Account, Contact, Case , or any table or as a standalone Email. Thus the flow was triggered unnecessarily and was terminated eventually, adding no value and wasting the flow runs.
As a solution, what we will do is
Step 1: Go to the Trigger “When a row is added, modified or deleted” and click on the three dots, then click on the settings as shown below:
Step 2:Locate “Trigger Conditions” towards the end >> Click on “+Add”
Step 3:If you are an expert in writing Expressions, just go ahead and start writing if not then you can write it in the Expression provided in the Power Automate in any other step of the flow and copy it here. Just make sure you place the special character “@” in front of it always.
I have written the following Expression for comparing the RegardingType of Email to Entity Type ‘incident’ i.e. the Case:
PS: I got the first parameter of Equals simply from the condition variable I used in the Condition Action- you may either hover on it to see the value or copy it directly.
Step 4:Click on Done and remove the condition step from beneath as you longer need to again check it and save the Flow.
Outcome: So now when we create an Email from case, we see that it runs successfully but when we create an Email from Contact, it doesn’t run at all. Thus saving us a mammoth amount of flow calls which are counted as API request. Thus saving us from reaching the API request limits faster.
We see that this is a much much more efficient way of writing Flows where the condition is checked at the onset rather than doing the check once the automation has started.
1.Using trigger conditions, one can control the flow to execute or not. This also prevents generating unnecessary entries in Run History.
2.If your Trigger Condition is not correct, the Flow will prompt you during Save.
3. You can also secure the trigger inputs/outputs in the run history of a cloud flow. To do this, you can turn on the secure input and/or secure output setting in the trigger.
Hope it helps! Explore other settings here too.
& the Power Quote of the day is:
“The world is full of obvious things which nobody by any chance ever observes” ~Sherlock Holmes