A flow I built for a client’s project team kept sending the same email for every task, whether it was urgent or not, finished or not. What it needed was one small decision: if the task is high priority, say so, otherwise keep it short. In Power Automate, that decision is the if() expression.
Below I’ll show you the syntax, how it evaluates, how to use it with SharePoint dynamic content, how to nest it for if-else-if logic, when the Condition action is the better choice, and how to fix the errors people hit most often.
Quick answer: Use if(condition, valueIfTrue, valueIfFalse) in a Compose action, a variable or any input field, for example if(equals(triggerBody()?['Priority']?['Value'], 'High'), 'Urgent', 'Normal'). The condition must return a Boolean, so build it with equals(), greater(), empty(), and() or or(). For if-else-if, put another if() in the false argument.
How the if() expression works
Cloud flows use the Workflow Definition Language for expressions, not Power Fx (that’s the Power Apps formula language). The if() function takes three required arguments and returns whichever value matches the result of the test. You can browse the other functions from the Power Automate tutorials hub.
if(<expression>, <valueIfTrue>, <valueIfFalse>)
| Argument | Type | What it does |
|---|---|---|
| expression | Boolean | The test, for example equals(1, 1) or greater(5, 3) |
| valueIfTrue | Any | Returned when the test is true |
| valueIfFalse | Any | Returned when the test is false |

The values can be text, numbers, Booleans, objects or other expressions, so if() can feed a Compose action, an email subject, a SharePoint column or a variable. Microsoft documents that the parameters are evaluated from left to right.
To try it, add a Compose action, open the expression editor (the fx icon), and enter if(equals(2, 2), 'Yes', 'No'). Run the flow and the output is Yes. If you’d rather store the result, initialize a variable in Power Automate and use the expression as its value.

Use if() with dynamic content and SharePoint list values
Most real expressions test a value from the trigger or an earlier action. When you pick dynamic content in the expression editor, Power Automate writes the reference for you, such as triggerBody()?['Revenue']. Each SharePoint column type comes through a little differently:
| Column type | Example if() expression |
|---|---|
| Number | if(greater(triggerBody()?['Revenue'], 10000), 'Large deal', 'Standard') |
| Choice | if(equals(triggerBody()?['Status']?['Value'], 'Approved'), 'Go', 'Wait') |
| Yes/No | if(triggerBody()?['IsCompleted'], 'Done', 'Open') |
| Person | if(empty(triggerBody()?['AssignedTo']?['Email']), 'Unassigned', 'Assigned') |
| Text | if(equals(toLower(triggerBody()?['Department']), 'finance'), 'Finance', 'Other') |
A Choice column is an object, so you compare its Value, not the column itself. A Yes/No column is already a Boolean, so it can be the test on its own. For more column comparisons, see checking if a SharePoint column equals a value.
Here’s a simple numeric test in a Compose action, if(greater(15, 10), 'High', 'Low'), and its output:


Combine conditions with and(), or(), not() and other functions
The first argument can be any expression that returns true or false. These are the functions I use most inside if():
| Function | Returns true when | Example |
|---|---|---|
| equals(a, b) | Both values are equivalent | equals(triggerBody()?['Status']?['Value'], 'Approved') |
| greater / less | The first value is larger / smaller (same type on both sides) | greater(triggerBody()?['Amount'], 5000) |
| greaterOrEquals / lessOrEquals | Larger or equal / smaller or equal | lessOrEquals(variables('Days'), 3) |
| empty(x) | A string, array or object is empty | empty(triggerBody()?['Comments']) |
| contains(x, v) | The text or array has the value (case-sensitive) | contains(triggerBody()?['Title'], 'Urgent') |
| and(a, b, …) | Every expression is true | and(greater(x, 100), equals(y, 'US')) |
| or(a, b, …) | At least one expression is true | or(equals(t, 'Sick Leave'), equals(t, 'Emergency Leave')) |
| not(a) | The expression is false | not(empty(triggerBody()?['Manager'])) |
Both and() and or() accept more than two expressions, so you don’t have to nest them. For example, this returns Escalate only for high-value US orders that aren’t already approved:
if(and(greater(triggerBody()?['Amount'], 5000), equals(triggerBody()?['Region']?['Value'], 'US'), not(equals(triggerBody()?['Status']?['Value'], 'Approved'))), 'Escalate', 'Standard')
In a Condition action, the same OR logic is two rows with the group set to Or. I explain grouped rows in more detail in multiple conditions in Power Automate.

Here’s the same Or logic in a real run. Olivia Martinez asked for Sick Leave on the Leave Requests list, the first row matched, and the True branch built the note for her manager:

Nested if and if-else-if in Power Automate
There’s no separate else or elseif function. The false argument is your else, and putting another if() there gives you else-if. Say a string variable varStatus holds Pending, Approved or Rejected:

if(equals(variables('varStatus'), 'Pending'), 'Needs Review',
if(equals(variables('varStatus'), 'Approved'), 'Completed',
if(equals(variables('varStatus'), 'Rejected'), 'Denied',
'Unknown Status')))

With Pending, the output is Needs Review. Anything that matches none of the tests falls through to Unknown Status, which is a good habit: always give the last if() a sensible default.

Past three or four levels, nested if() gets hard to read. When you compare one value against many options, a Switch action is cleaner (up to 25 cases). If a Switch run fails, see the Switch action failed error. Nested Condition actions are limited to 8 levels, so move deeper logic into a child flow.
Condition action vs if() expression: when to use which
Both make a decision, but they do different jobs. The if() expression returns a value. The Condition action runs different actions on its True and False branches (If yes and If no in the classic designer).
| Use | if() expression | Condition action |
|---|---|---|
| Pick a value (subject line, status text, default) | Best choice | Works, but needs two actions |
| Run different actions (email vs Teams post) | Can’t do it | Best choice |
| Readability for others | Harder when nested | Easy to see in the designer |
| Action count | No extra actions | Adds a Condition plus branch actions |
My rule: if both branches would run the same action with a different value, use if() inside that one action. If the branches do different work, use a Condition. For example, a Sales Tracker list should alert the manager only when Revenue is over $10,000.

Add a Condition, select Revenue from the dynamic content in the left box, choose is greater than, and type 10000 in the right box. Then add Send an email (V2) in the True branch.


Add an item with Revenue of 15,000 and the True branch sends the alert.

If you only want the flow to start for big deals, a trigger condition is even better, because the flow doesn’t run at all otherwise. See Power Automate trigger conditions.
Null-safe patterns: the ? operator, coalesce() and empty()
Blank SharePoint columns and optional trigger inputs often come through as null, or the property isn’t there at all. Three habits keep if() from failing on them:
- Use ? when reading properties.
triggerBody()?['DueDate']returns null if DueDate is missing, whiletriggerBody()['DueDate']fails the action. - Use coalesce() for defaults. It returns the first value that isn’t null, so
coalesce(triggerBody()?['date'], utcNow('yyyy-MM-dd'))uses today when the date input is left blank. It’s shorter than an if(). - Check blanks with empty(coalesce(x, ”)). Microsoft notes that empty strings aren’t null, and comparing null isn’t the same as comparing an empty string. This pattern catches both.
Person and lookup columns need the same care. I cover them in how to check if a person field is empty, and other column types in checking if a field is blank in Power Automate.
Here’s coalesce() in a Compose action from a manual flow where I left the Request date input blank. The output falls back to today’s date:

Real work scenarios
Approval status. After Start and wait for an approval, the outcome is Approve or Reject for a basic approval. I use if() to turn it into the text I store in the list’s Status column:
if(equals(outputs('Start_and_wait_for_an_approval')?['body/outcome'], 'Approve'), 'Approved', 'Rejected')

Due dates. To flag overdue tasks, compare ticks of the due date with ticks of utcNow(). The coalesce() calls keep it safe when the due date is blank, so I don’t depend on the false branch being skipped:
if(empty(coalesce(triggerBody()?['DueDate'], '')), 'No due date',
if(less(ticks(coalesce(triggerBody()?['DueDate'], utcNow())), ticks(utcNow())), 'Overdue', 'On track'))
A task due 10/20/2026 shows On track on 10/12/2026 and Overdue a week later. To build a reminder date, add days to a date in Power Automate first.
In my Task Tracker list, Update vendor contract was due 10/9/2026 and isn’t done, so on 10/14/2026 the Compose returned Overdue:


Yes/No columns. On a Task Tracker list, the email to the manager should go only when IsCompleted is Yes. In the Condition, enter true through the expression editor, not as typed text. The email body formats the time in US style; more patterns are in formatDateTime() in Power Automate:
Hi Megan,
The task @{triggerBody()?['Title']} was marked as completed.
Completed on: @{formatDateTime(utcNow(), 'MM/dd/yyyy h:mm tt')}
Thanks,
Power Automate


Common errors and how to fix them
- InvalidTemplate, “Unable to process template language expressions”: the expression ran into a value it can’t handle, usually null or a missing property. Add ? to property references and wrap optional values in coalesce().
- Type mismatch in greater() or less(): both sides must be the same type. Text inputs from a manual trigger or Microsoft Forms are strings, so convert them first, for example
greater(int(triggerBody()?['text']), 1000). See how to convert a string to an integer. - The string ‘true’ isn’t the Boolean true: if() expects a Boolean test. Values from Forms, HTTP requests or text columns arrive as text, so use
bool()orequals(x, 'Yes')instead of passing the text in directly. - Case differences: contains() is case-sensitive. Compare with
toLower()on both sides when users type the value. - Quotes: text values in expressions use single quotes, as in
'Approved'. Double quotes cause an invalid expression error. - Expression too long: one expression can be up to 8,192 characters. Long nested if() chains are better as a Switch.
Here’s the type mismatch for real. The manual trigger sends Amount as text (1500), so greater() fails with InvalidTemplate, while the int() version in the next action works:


For more string tests in a Condition, see Power Automate condition if string examples.
If you’re building more decision logic into your flows, these step-by-step guides help next:
Frequently Asked Questions
How do I write an if else statement in Power Automate?
Use if(condition, valueIfTrue, valueIfFalse). The third argument is the else. For else-if, put another if() in the third argument, and end the chain with a default value.
Can I use an if expression with dynamic content?
Yes. Open the expression editor, type if(, and pick the dynamic content inside it, for example if(equals(triggerBody()?[‘Status’]?[‘Value’], ‘Approved’), ‘Yes’, ‘No’).
What is the difference between the Condition action and the if() expression?
The if() expression returns a value inside one action. The Condition action runs different actions in its True and False branches. Use if() to choose a value and a Condition to choose what the flow does.
How do I check for null in a Power Automate if expression?
Read properties with ?, then test empty(coalesce(value, ”)). To supply a default instead, use coalesce(value, ‘default’) without any if().
Where can I see every function I can use inside if()?
Microsoft lists all logical, comparison and conversion functions in the workflow expression functions reference, including equals(), greater(), empty(), and() and or().

Hey! I’m Bijay Kumar, founder of SPGuides.com and a Microsoft Business Applications MVP (Power Automate, Power Apps). I launched this site in 2020 because I truly enjoy working with SharePoint, Power Platform, and SharePoint Framework (SPFx), and wanted to share that passion through step-by-step tutorials, guides, and training videos. My mission is to help you learn these technologies so you can utilize SharePoint, enhance productivity, and potentially build business solutions along the way.
please how do i resolve this
get items returns [] output.
the filter query returns the correct result but the output is empty