In this tutorial, we’ll discuss Power Automate trigger conditions that allow us to execute blocks of actions once a given situation is met. Using condition control, we can assure that certain elements in our flow are in our required state before performing the actions.
A trigger condition in Power Automate is similar to an IF statement in Excel or in any other programming language. It splits our flow into two pathways based on a condition.
Adding Trigger Conditions In Power Automate
We’ll be using a sample flow that I created beforehand. In this sample flow, we’ll receive an email notification once a user posts a tweet that contains the words “Power Automate”. Then, we’ll add a condition where if the word “issue” is found on the tweet, it will create a Trello card. Otherwise, it will just retweet that specific tweet and it won’t create a Trello card.
To add a condition, let’s add another step by clicking the New step button.
Then, click Control.
After that, let’s add a trigger condition by clicking Condition Control.
We then need to set the values for our condition.
If the condition is true, then it goes down to the If yes pathway. Otherwise, it will go to the If no pathway. We can also set the actions here based on the condition output.
Configuring Power Automate Trigger Conditions
On our Trello board, let’s add a new section and name it “Issues“.
For our condition, let’s use the Tweet text variable for our true statement.
Again, we want to see if the tweet has the word “issue”. So, let’s use “contains” in this part.
For the third field, let’s add the word “Issue”. We need to add a quotation because it’s a string, not a variable.
We can add multiple conditions by clicking the + Add button. For this example, let’s add another row.
We can also choose between the “AND” and “OR“ conditions.
For an “AND“condition, both of the arguments have to be true for it to be passed to the If yes section. If it’s an OR condition, either of the statements should be true.
For this example, we will use the OR condition.
For the second condition, let’s use the Tweet text variable, then set the condition as “contains” and add the word “Problem”.
Let’s now add an action if our condition results to true. Remember that we want to create a Trello card if the tweet meets either of the conditions. Therefore, we can just drag the Create a card action to our If yes section.
Now, let’s add an action to the If no section if the tweet doesn’t meet any of the conditions. Just click the Add an action button.
Let’s look for the Twitter connector and click on it.
Then, click the Retweet action.
For the Tweet id, let’s use the Tweet id variable.
We’re now done setting up our flow. When a new tweet is posted, it will first send us an email notification. Then, it will look at the condition that we’ve set to analyze if it should either retweet the tweet or create a Trello card.
Testing The Condition
Let’s now test our condition. This time, let’s perform a manual trigger instead of using the data from our previous runs.
We’ll tweet “Power Automate has an issue 🙁”.
Our flow is now running in the background and looking for a tweet that will meet the search term and conditions that we’ve set.
We can check the output once our flow test runs successfully. As we can see, the result was false even though our tweet contained the word “issue”.
This is probably because in our tweet, we wrote the word “issue” with a small “i”.
But on our condition, we specified the word “Issue” with a capital “I”.
Converting Strings To Lowercase
What we need to do is to convert these Tweet text variables to lowercase. This is to make sure that even though the tweet has a small or capital letter, it will all be treated as a lowercase.
To do that, instead of using a variable in this part, we need to convert it into an expression. So, let’s remove the Tweet text variable.
Let’s use an expression called toLower. The toLower expression converts texts into a lowercase format.
Let’s add parenthesis and put the Tweet text variable inside.
Then, let’s click the OK button.
Let’s also do similar steps with the second condition.
Then, change the “Issue” and “Problem” texts to lowercase.
Retesting The Conditon
Save this flow and let’s make another test. Again, we’ll perform a manual trigger for this test.
This time, let’s tweet “There’s a Problem with Power Automate ”. We’ll use a capital “P” for the word “problem” to see if our expression will work.
Let’s now check the result. As we can see, the result is now true because the tweet contains the word “problem”. We’ve used a capital “P” but the result is still true as it was converted into lowercase. Our expression is now working properly.
Since the result is true, it should now be added to our Trello board as a card. I made a mistake here because I should have changed the section to Issues instead of Twitter, but it’s fine for now.
Let’s click on this card and we’ll see that it recorded our tweet that says “There’s a Problem with Power Automate” into the Description.
***** Related Links *****
Power Automate Template | Creating And Running Flows
Power Automate Flows Creation From Scratch
Power Automate Actions | A Deep Dive Tutorial
To summarize what we’ve done in this tutorial, we posted a tweet that includes the words “Power Automate”. Then, it sent an email notification and tested our OR condition if it had the words “issue” or “problem” in it. Since the condition resulted in TRUE, it created a Trello card and didn’t retweet it.
Again, conditions are just IF statements that separate our flow based on some specified condition that we’ve put in. Hopefully, this helps you learn more about conditions and how you can make them work in the process of automating your business.
All the best,