Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Triggers
  • Resources
  • ABOUT ME
  • Get help with your flow
Menu

Create easily the condition for Power Automate if(…) expression

Posted on February 26, 2023February 26, 2023 by Tom

“I’d like to use the if(…) expression but I don’t know how to create the condition, is there some trick in the Power Automate designer?”


Recently I published an article on replacing the ‘Condition’ actions with if(…) expressions to simplify a flow. Instead of a bunch of conditions and repeating actions you can have just a single action with if(…) expressions. But creating the right condition inside if(…) is a bit more complicated than using the standard action. How do you “rewrite” the condition? What should you “type in” as the first parameter of the expression?

Use the ‘Filter array’ action to create the condition

As with the trigger conditions, you can use a small trick and let the designer create the condition for you. Add the ‘Filter array’ action into your flow and recreate the condition you want to replace with the if(…) expression.

Click on ‘Edit in advanced mode’ to transform the condition inside ‘Filter array’ into text.

Remove the @ at the beginning and take the rest, that’s the condition to use as the first parameter in if(…).

Power Automate condition if expression

In this example to check whether a value is less than 3 it’d look as below.

if(less(outputs('Compose_-_Value'), 3), <ifTrue>, <ifFalse>)

Repeat the same process for all the ‘Condition’ actions you want to replace and build the whole expression step by step.

Summary

It might be a bit confusing when trying to replace the Power Automate ‘Condition’ with the if(…) expression, but it’s not that hard. If you use the workaround with the ‘Filter array’ action you don’t need to write the whole condition manually. Recreate the condition 1:1 in that action, switch to the text mode, remove the @, and the condition is ready. You can even combine multiple conditions together using this approach, just build it slowly, condition after condition.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Do you know what to do, but not how to do it?

Get The Ultimate Power Automate expressions cheat sheet and translate your thoughts into flows with ease!


There's also the HTTP requests to SharePoint cheat sheet to help you overcome limitations of some standard actions!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with 1000s of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2023 Let's POWER Automate | Theme by SuperbThemes