All ToolsPower Automate Expressions

Power Automate Expressions

Searchable reference for every Power Automate expression function — with syntax, description, and a live input/output example. Filter by category.

54 expressions

String

concat
concat(text1, text2, ...)

Concatenates strings together.

In
concat('Hello, ', 'World!')
Out
'Hello, World!'
length
length(collection)

Returns the number of characters in a string (or items in an array).

In
length('Power Automate')
Out
14
substring
substring(text, start, length?)

Extracts characters from a string starting at an index.

In
substring('Hello World', 6)
Out
'World'
toLower
toLower(text)

Converts a string to lowercase.

In
toLower('HELLO')
Out
'hello'
toUpper
toUpper(text)

Converts a string to uppercase.

In
toUpper('hello')
Out
'HELLO'
trim
trim(text)

Removes leading and trailing whitespace.

In
trim(' hello ')
Out
'hello'
replace
replace(text, old, new)

Replaces all occurrences of a substring.

In
replace('foo bar foo', 'foo', 'baz')
Out
'baz bar baz'
split
split(text, delimiter)

Splits a string into an array.

In
split('a,b,c', ',')
Out
['a','b','c']
startsWith
startsWith(text, prefix)

Returns true if text starts with prefix.

In
startsWith('Hello', 'He')
Out
true
endsWith
endsWith(text, suffix)

Returns true if text ends with suffix.

In
endsWith('Hello', 'lo')
Out
true
contains
contains(collection, value)

Returns true if string contains the value (also works with arrays).

In
contains('Hello World', 'World')
Out
true
indexOf
indexOf(text, value)

Returns the zero-based start position of a substring, or -1 if not found.

In
indexOf('Hello', 'l')
Out
2
formatNumber
formatNumber(number, format, locale?)

Formats a number as a string using a format specifier.

In
formatNumber(1234.5, 'C2', 'en-US')
Out
'$1,234.50'

Logical

if
if(condition, valueIfTrue, valueIfFalse)

Returns one of two values depending on a condition.

In
if(equals(1, 1), 'yes', 'no')
Out
'yes'
equals
equals(value1, value2)

Returns true if both values are equal.

In
equals('abc', 'abc')
Out
true
not
not(value)

Returns the boolean inverse of a value.

In
not(false)
Out
true
and
and(expr1, expr2, ...)

Returns true if all expressions are true.

In
and(true, equals(1,1))
Out
true
or
or(expr1, expr2, ...)

Returns true if any expression is true.

In
or(false, true)
Out
true
empty
empty(collection)

Returns true if a string, array, or object is empty.

In
empty('')
Out
true
coalesce
coalesce(value1, value2, ...)

Returns the first non-null value.

In
coalesce(null, null, 'fallback')
Out
'fallback'

Date & Time

utcNow
utcNow(format?)

Returns the current UTC timestamp.

In
utcNow()
Out
'2024-06-07T10:00:00.0000000Z'
convertTimeZone
convertTimeZone(timestamp, sourceZone, destZone, format?)

Converts a timestamp from one time zone to another.

In
convertTimeZone(utcNow(), 'UTC', 'Eastern Standard Time')
Out
'2024-06-07T06:00:00.0000000'
addDays
addDays(timestamp, days, format?)

Adds a number of days to a timestamp.

In
addDays(utcNow(), 7)
Out
timestamp + 7 days
addHours
addHours(timestamp, hours, format?)

Adds hours to a timestamp.

In
addHours(utcNow(), 2)
Out
timestamp + 2 hours
formatDateTime
formatDateTime(timestamp, format?)

Formats a timestamp string.

In
formatDateTime(utcNow(), 'yyyy-MM-dd')
Out
'2024-06-07'
dayOfWeek
dayOfWeek(timestamp)

Returns the day of the week as an integer (0 = Sunday).

In
dayOfWeek(utcNow())
Out
5 (Friday)
ticks
ticks(timestamp)

Returns ticks (100ns intervals since Jan 1 0001) for a timestamp.

In
ticks(utcNow())
Out
638000000000000000

Collection

first
first(collection)

Returns the first item in an array or string.

In
first([1, 2, 3])
Out
1
last
last(collection)

Returns the last item in an array.

In
last([1, 2, 3])
Out
3
take
take(collection, count)

Returns the first N items from an array.

In
take([1,2,3,4], 2)
Out
[1, 2]
skip
skip(collection, count)

Removes the first N items from an array.

In
skip([1,2,3,4], 2)
Out
[3, 4]
union
union(array1, array2, ...)

Returns an array with unique items from all arrays.

In
union([1,2],[2,3])
Out
[1, 2, 3]
intersection
intersection(array1, array2)

Returns items that appear in all collections.

In
intersection([1,2,3],[2,3,4])
Out
[2, 3]
join
join(array, delimiter)

Joins array items into a string.

In
join(['a','b','c'], ', ')
Out
'a, b, c'
sort
sort(array)

Sorts an array of values.

In
sort([3,1,2])
Out
[1, 2, 3]

Math

add
add(number1, number2)

Adds two numbers.

In
add(3, 4)
Out
7
sub
sub(number1, number2)

Subtracts the second number from the first.

In
sub(10, 3)
Out
7
mul
mul(number1, number2)

Multiplies two numbers.

In
mul(3, 4)
Out
12
div
div(number1, number2)

Divides two numbers.

In
div(10, 2)
Out
5
mod
mod(number1, number2)

Returns the remainder after division.

In
mod(10, 3)
Out
1
max
max(collection_or_values)

Returns the highest number from a collection.

In
max([3, 1, 4, 1, 5])
Out
5
min
min(collection_or_values)

Returns the lowest number from a collection.

In
min([3, 1, 4])
Out
1
rand
rand(minValue, maxValue)

Returns a random integer in a range.

In
rand(1, 10)
Out
7 (random)

Conversion

int
int(value)

Converts a string to an integer.

In
int('42')
Out
42
float
float(value)

Converts a string to a floating-point number.

In
float('3.14')
Out
3.14
string
string(value)

Converts a value to a string.

In
string(42)
Out
'42'
bool
bool(value)

Converts a value to a boolean.

In
bool('true')
Out
true
json
json(text)

Parses a JSON string into an object or array.

In
json('{"key":"val"}')
Out
{ key: 'val' }
base64
base64(value)

Returns the base64 encoding of a string.

In
base64('Hello')
Out
'SGVsbG8='
base64ToString
base64ToString(value)

Decodes a base64 string.

In
base64ToString('SGVsbG8=')
Out
'Hello'
encodeUriComponent
encodeUriComponent(text)

Encodes a string for safe use in a URL.

In
encodeUriComponent('hello world')
Out
'hello%20world'

Object

addProperty
addProperty(object, property, value)

Adds a property to a JSON object.

In
addProperty(json('{}'), 'key', 'val')
Out
{ key: 'val' }
removeProperty
removeProperty(object, property)

Removes a property from a JSON object.

In
removeProperty(body('Parse_JSON'), 'id')
Out
object without 'id'
setProperty
setProperty(object, property, value)

Sets or updates a property on a JSON object.

In
setProperty(variables('myObj'), 'status', 'done')
Out
updated object