Functions
Use built-in functions in Dynamic Expressions to transform and check text, calculate numbers, format values and handle empty results or errors.
Built-in functions let you transform text, calculate numbers, and format values in Dynamic Expressions. Each function returns a result you can use in surrounding text or in another calculation. This page shows how to write a function call and choose the right function.
Write a function call
Write a function as NAME(argument, argument) inside double curly braces. Arguments are the comma-separated values or expressions you pass inside the parentheses. Function names aren't case-sensitive.
To try a function in a supported editable text field:
- Enter
{{. A list of available Dynamic Variables and functions appears. - Select UPPERCASE. The expression opens for editing, with the cursor inside the parentheses.
- Enter
"ready"as the argument. - Select Done. The expression is added to the field.
The completed expression, {{ UPPERCASE("ready") }}, returns READY. The quoted word "ready" is a text literal: a value you supply directly.
If myText is an available Dynamic Variable, try {{ LENGTH(UPPERCASE(myText)) * 2 }}. UPPERCASE takes the variable as its argument, and LENGTH takes the result of UPPERCASE. The multiplication operator then doubles the length using the number literal 2.
Transform and check text
Text searches and replacements are case-sensitive, even though function names aren't.
Function | What it does | Returns |
|---|---|---|
| Joins one or more strings and converts them to uppercase. | Text |
| Joins strings and converts them to lowercase. | Text |
| Capitalizes the first letter of each string, then joins the strings. | Text |
| Removes whitespace from the start and end of each string, then joins the strings. | Text |
| Replaces every literal occurrence of | Text |
| Keeps up to the specified length and adds | Text |
| Joins two or more strings without a separator. | Text |
| Repeats the text. If you omit | Text |
| Joins one or more suffixes after the text. | Text |
| Joins one or more prefixes before the text. | Text |
| Checks whether the text begins with | Boolean |
| Checks whether the text ends with | Boolean |
| Checks whether the text contains | Boolean |
| Measures the length of the joined strings. It doesn't count list items. | Number |
REPEAT clamps the repetition count to 0–10,000. It caps the repeated text at 1,000 characters or the original text length, whichever is larger. It adds ... if it shortens the result.
Calculate numbers
For calculations that work left to right, each later argument acts on the running result.
Function | What it does |
|---|---|
| Returns the absolute value. |
| Adds two or more numbers. If all arguments are dates, it adds their timestamps. |
| Takes at least two numbers and subtracts each later number, left to right. |
| Multiplies two or more numbers. |
| Takes at least two numbers and divides by each later number, left to right. |
| Takes at least two numbers and finds the remainder using each later number as the divisor, left to right. |
| Rounds to the nearest whole number. |
| Rounds up to a whole number. |
| Rounds down to a whole number. |
| Returns the largest of one or more numbers or the latest of one or more dates. |
| Returns the smallest of one or more numbers or the earliest of one or more dates. |
| Takes at least two numbers and uses each later number as the next exponent, left to right. |
| Returns the arithmetic mean of two or more numbers. |
Use all numbers or all dates in MIN and MAX. Mixing the two causes an error.
Format values and choose what to return
Function | What it does |
|---|---|
| Formats numbers, dates, and booleans according to the locale. It turns |
| Joins the prefixes and places them before the text. |
| Joins the suffixes and places them after the text. |
| Follows keys or numeric list indexes in order and parses JSON text along the way. List indexes start at zero. With no path, it returns the original value. If the path doesn't exist, it returns |
| Evaluates and returns only |
| Returns the fallback only if evaluating |
| Returns the fallback for empty values, unresolved expressions, empty rich text, or evaluation errors. |
| Works like |
| Returns |
Handle empty values and errors
Use IFEMPTY when you want a default for a missing or blank value. For example, {{ IFEMPTY(null, "fallback") }} returns "fallback". Empty values include null, undefined, blank text, NaN, empty objects, and empty lists. A list containing only null or undefined also counts as empty. Zero and false don't count as empty.
Use IFERROR when you want a fallback only if a calculation fails. Dividing by zero raises an error, whether you use / or DIVIDE. For example, {{ IFERROR(10 / 0, 0) }} returns 0. MOD also raises an error with a zero divisor, and POW raises an error if you raise zero to a negative power.
If an expression doesn't work, check that each opening parenthesis has a matching closing parenthesis. Check for missing required arguments or arguments of the wrong type. In {{ IFEMPTY(IFERROR(10 / 0, 0), "empty fallback") }}, each call has its own matching parentheses. The result is 0 because the inner fallback isn't empty.
Common questions
Which fields support dynamic expressions?
Dynamic Expressions work in the subject and message of a Send Email action and in the prompt of an AI Step. See Variables and Expressions for how to insert them.
Which idea fields can I use in a function?
You can pass an idea field to a function when it’s available as a variable in that step. The available context variables depend on the trigger, earlier steps, and the automation’s context.
How can I check why a function failed during an automation run?
To investigate a function failure, select the run counter in the automation editor to open Runs. Open the failed run and inspect the step that used the function in the run details.