← Cheat sheets

Power Automate (WDL) cheat sheet

Power Automate expressions are Workflow Definition Language (WDL), not Power Fx. The functions, the syntax, and the case rules are different — wdl function names are camelCase and quotes are single quotes. Everything below is a genuine WDL expression you can drop into the expression editor.

/

Referencing data

Most flow logic is plumbing values between actions. These functions pull values out of triggers, actions, variables, and loop items.

triggerBody
The body of the trigger
triggerBody()?['Email']
→ A trigger field
The ?[ ] syntax is null-safe — it returns null instead of failing when the field is missing.
triggerOutputs
Full outputs of the trigger
triggerOutputs()?['headers']
→ Trigger output
outputs
Outputs of a named action
outputs('Compose')
→ Action output
body
Body of a named action
body('Get_item')?['Title']
→ Action body field
item
Current item in Apply to each
item()?['ID']
→ Loop item field
items
Item of a named loop
items('Apply_to_each')?['Status']
→ Loop item field
Use items() with the loop name when you nest loops, so you can target a specific one.
variables
Read a flow variable
variables('counter')
→ Variable value
parameters
Read an environment parameter
parameters('ApiBaseUrl')
→ Parameter value

Strings

concat
Join strings together
concat('PO-', variables('id'))
→ "PO-1042"
substring
Slice by position and length
substring('PowerStack', 5, 5)
→ "Stack"
replace
Replace all occurrences
replace('a-b-c', '-', '/')
→ "a/b/c"
toUpper('po-12')
→ "PO-12"
trim
Remove leading/trailing spaces
trim(' hi ')
→ "hi"
length
Count characters (or array items)
length('PowerStack')
→ 10
indexOf
Position of a substring
indexOf('a@b.com', '@')
→ 1
startsWith / endsWith
Test a prefix or suffix
startsWith(item()?['Name'], 'PO-')
→ true / false
split
Break a string into an array
split('a,b,c', ',')
→ ["a","b","c"]
guid
Generate a new GUID
guid()
→ A unique id
formatNumber
Format a number as a string
formatNumber(1234.5, 'C2', 'en-GB')
→ "£1,234.50"

Arrays & collections

first / last
First or last array element
first(body('Get_items')?['value'])
→ One item
length
Count items in an array
length(variables('rows'))
→ A number
contains
Test for membership
contains(variables('ids'), 7)
→ true / false
empty
Test for an empty array/string/object
empty(body('Get_items')?['value'])
→ true / false
The cleanest way to branch on a no-results query.
join
Join an array into a string
join(variables('tags'), ', ')
→ "x, y, z"
take / skip
Slice from the start / past the start
take(variables('rows'), 10)
→ First 10
union
Merge arrays, dropping duplicates
union(variables('a'), variables('b'))
→ Combined array
intersection
Items present in both arrays
intersection(variables('a'), variables('b'))
→ Common items
createArray
Build an array from values
createArray('a', 'b', 'c')
→ ["a","b","c"]
range
Sequence of integers
range(1, 5)
→ [1,2,3,4,5]
reverse
Reverse array order
reverse(variables('rows'))
→ Reversed array

Logic & comparison

WDL has no operators — comparisons and boolean logic are all functions that take their arguments in parentheses.

if
Return a value by condition
if(greater(variables('n'), 0), 'pos', 'neg')
→ One of two values
equals
Test equality
equals(item()?['Status'], 'Open')
→ true / false
greater / less
Numeric comparison
greater(variables('total'), 1000)
→ true / false
greaterOrEquals / lessOrEquals
Inclusive comparison
lessOrEquals(variables('age'), 17)
→ true / false
and
All conditions true
and(variables('active'), variables('paid'))
→ true / false
or
Any condition true
or(equals(s, 'A'), equals(s, 'B'))
→ true / false
not
Invert a condition
not(empty(variables('rows')))
→ true / false
coalesce
First non-null value
coalesce(item()?['Nick'], item()?['Name'], 'Guest')
→ First with a value

Type conversion

int
Parse to integer
int(triggerBody()?['Qty'])
→ A whole number
float
Parse to floating point
float('123.45')
→ 123.45
string
Convert to text
string(variables('count'))
→ "42"
bool
Convert to boolean
bool('true')
→ true
json
Parse a JSON string to an object
json(triggerBody())
→ An object
Use after an HTTP action whose body is a string of JSON.
array
Wrap a value in an array
array(item())
→ A one-item array
base64
Encode text as base64
base64('hello')
→ Base64 text
base64ToString
Decode base64 to text
base64ToString(variables('enc'))
→ "hello"
decimal
Exact decimal value
decimal('19.99')
→ A decimal
Prefer decimal over float for money to avoid rounding drift.

Date & time

Stored timestamps are UTC. Convert to the user’s zone only for display.

utcNow
Current UTC timestamp
utcNow()
→ ISO 8601 string
formatDateTime
Format a timestamp
formatDateTime(utcNow(), 'dd MMM yyyy')
→ "13 Jun 2026"
addDays
Add days
addDays(utcNow(), 7)
→ One week out
addHours / addMinutes
Add smaller spans
addHours(utcNow(), -2)
→ Two hours ago
addToTime
Add an arbitrary span
addToTime(utcNow(), 3, 'Month')
→ A timestamp
startOfDay / startOfMonth
Snap to a boundary
startOfDay(utcNow())
→ Midnight today
dayOfWeek
Day-of-week number
dayOfWeek(utcNow())
→ 0 (Sun) to 6 (Sat)
ticks
Timestamp as a tick count
ticks(utcNow())
→ A big integer
Subtract two ticks values, then divide, to get elapsed time.
convertFromUtc
UTC to a target zone
convertFromUtc(utcNow(), 'GMT Standard Time')
→ Local time
convertTimeZone
Between two zones
convertTimeZone(t, 'UTC', 'Eastern Standard Time')
→ Converted time

Math

add / sub
Add or subtract
add(variables('total'), 5)
→ A number
mul / div
Multiply or divide
div(variables('total'), 2)
→ A number
div of two integers does integer division — wrap an argument in float() for decimals.
mod
Remainder after division
mod(17, 5)
→ 2
min / max
Smallest or largest argument
max(variables('a'), variables('b'))
→ A number
rand
Random integer in a range
rand(1, 100)
→ e.g. 42
Upper bound is exclusive.

Objects & JSON

null-safe access ?[ ]
Read a field without failing
body('Get_item')?['Author']?['Email']
→ A value or null
Chain ?[ ] through every level. One missing link otherwise breaks the whole expression.
addProperty
Add a field to an object
addProperty(item(), 'Processed', true)
→ New object
setProperty
Set/replace a field
setProperty(item(), 'Status', 'Done')
→ New object
removeProperty
Drop a field
removeProperty(item(), 'Temp')
→ New object
xpath
Query an XML document
xpath(xml(body('HTTP')), '//title/text()')
→ Matching nodes
coalesce
First non-null of several fields
coalesce(item()?['Mobile'], item()?['Phone'])
→ First with a value