Cheat Sheets/Power Automate/if
Power Automate (WDL) function

ifPower Automate (WDL) function reference

Return a value by condition.

Syntax

wdl
if(expression, valueIfTrue, valueIfFalse)

Examples

wdl
if(greater(variables('n'), 0), 'pos', 'neg')
One of two values

There is no elseif — nest another if() in the false branch for a third outcome.

wdl
if(equals(item()?['Status'], 'Approved'), 'Green', if(equals(item()?['Status'], 'Rejected'), 'Red', 'Yellow'))
"Green" / "Red" / "Yellow"
wdl
if(greater(length(triggerBody()?['Comments']), 0), triggerBody()?['Comments'], 'No comments provided')
The comment text, or the fallback string

Common mistakes & gotchas

Related Workflow Definition Language functions

From Logic & comparison

Used in these tutorials

← Back to the Power Automate (WDL) cheat sheet