Back to Activepieces

Formula Function Reference

docs/flows/formula-reference.mdx

0.85.012.4 KB
Original Source

This is the complete catalog of formula functions. Most users will reach for them through the / slash trigger inside any text input — see Using Formulas for an introduction.

Syntax

function_name(arg1; arg2; arg3)
  • Arguments are separated by semicolons (;), not commas.
  • Argument types are checked while you edit; type mismatches show up in the preview panel under the input.
  • Formulas can be nested freely — any argument can be another formula.
  • Quotes around text arguments are optional (combine(John; Smith) and combine("John"; "Smith") both work), except for empty or whitespace-only values — use "" for an empty string and " " for a single-space separator.

Text

Functions that work with strings of text.

FunctionSignatureDescriptionExample
combinecombine(text1; text2; separator)Joins two or more values into one piece of text.combine(John; Smith; " ")John Smith
uppercaseuppercase(text)Changes all characters to uppercase.uppercase(acme inc)ACME INC
lowercaselowercase(text)Changes all characters to lowercase.lowercase([email protected])[email protected]
titlecasetitlecase(text)Capitalizes the first letter of every word.titlecase(john smith)John Smith
trimtrim(text)Removes space characters at the start and end.trim( Hello World )Hello World
prefixprefix(text; value)Adds text before a value.prefix(10042; ORD-)ORD-10042
suffixsuffix(text; value)Adds text after a value.suffix(Acme; " Ltd.")Acme Ltd.
replacereplace(text; find; with)Finds a word or character and swaps it for another.replace(first_name; "_"; " ")first name
removeremove(text; value)Deletes every occurrence of a character or word.remove(004-420-712; "-")004420712
first_nfirst_n(text; n)Returns only the first N characters.first_n(Jonathan; 3)Jon
last_nlast_n(text; n)Returns only the last N characters.last_n(ACC-7890; 4)7890
truncatetruncate(text; n)Cuts text to N characters and adds ... at the end.truncate(Annual Revenue Report; 14)Annual Revenue...
splitsplit(text; separator; index)Breaks text into parts and returns one of them.split(John Smith; " "; 0)John
extract_betweenextract_between(text; start; end)Returns the text sitting between two markers.extract_between(Status [urgent]; "["; "]")urgent
extract_emailextract_email(text)Finds and returns the first email address in a text.extract_email(Contact [email protected] for help)[email protected]
extract_urlextract_url(text)Finds and returns the first URL in a text.extract_url(Visit https://acme.com today)https://acme.com
lengthlength(text)Counts how many characters are in the text.length(Hello World)11
containscontains(text; value)Checks if the text has a specific word or character in it.contains(bug, urgent, backend; urgent)TRUE
starts_withstarts_with(text; value)Checks if the text begins with a specific value.starts_with([email protected]; info@)FALSE
ends_withends_with(text; value)Checks if the text ends with a specific value.ends_with(report.pdf; .pdf)TRUE
remove_spacesremove_spaces(text)Removes all extra spaces and line breaks inside the text.remove_spaces(hello world)hello world
word_countword_count(text)Counts how many words are in the text.word_count(The quick brown fox)4

Number

Functions for arithmetic and formatting numeric values.

FunctionSignatureDescriptionExample
addadd(num1; num2)Adds two numbers together.add(49.99; 5.00)54.99
subtractsubtract(num1; num2)Takes the second number away from the first.subtract(100.00; 10.50)89.5
multiplymultiply(num1; num2)Multiplies two numbers together.multiply(3; 49.99)149.97
dividedivide(num1; num2)Divides the first number by the second.divide(4999; 100)49.99
roundround(number; decimals)Rounds a number to a set number of decimal places.round(49.9871; 2)49.99
round_upround_up(number)Always rounds up to the next whole number.round_up(7.1)8
round_downround_down(number)Always rounds down to the previous whole number.round_down(7.9)7
absoluteabsolute(number)Returns the positive version of a number, removing any minus sign.absolute(-42.00)42
percentagepercentage(value; total)Calculates what percentage the value is of the total.percentage(75; 100)75%
format_numberformat_number(number; decimals)Adds thousand separators so large numbers are easier to read.format_number(1250000; 2)1,250,000.00
format_currencyformat_currency(number; symbol)Adds a currency symbol and formats the number.format_currency(49.99; "$")$49.99
cents_to_dollarscents_to_dollars(number)Converts a value stored in cents into dollars.cents_to_dollars(4999)$49.99
minmin(num1; num2)Returns the smaller of two numbers.min(87; 100)87
maxmax(num1; num2)Returns the larger of two numbers.max(-5; 0)0
to_numberto_number(text)Converts a text value into a number you can calculate with.to_number(1990)1990

Date

Functions for working with dates and times.

FunctionSignatureDescriptionExample
format_dateformat_date(date; format)Changes how a date looks using a format you pick.format_date(2025-01-15; MMM DD, YYYY)Jan 15, 2025
format_date_longformat_date_long(date)Shows the full date written out in plain language.format_date_long(2025-01-15)Friday, January 15, 2025
format_timeformat_time(date; format)Pulls the time out of a date and formats it.format_time(2025-01-15T14:30:00Z; h:mm A)2:30 PM
relative_timerelative_time(date)Shows how long ago or how far away a date is.relative_time(2025-01-12)3 days ago
add_daysadd_days(date; n)Adds a number of days to a date.add_days(2025-01-15; 30)Feb 14, 2025
subtract_dayssubtract_days(date; n)Goes back a number of days from a date.subtract_days(2025-01-15; 7)Jan 08, 2025
add_hoursadd_hours(date; n)Adds a number of hours to a date and time.add_hours(2025-01-15T14:30:00Z; 2)2025-01-15T16:30:00Z
days_betweendays_between(date1; date2)Counts how many days are between two dates.days_between(2025-01-01; 2025-01-15)14
get_dayget_day(date)Returns the day number from a date (1–31).get_day(2025-01-15)15
get_monthget_month(date)Returns the month from a date.get_month(2025-01-15)January
get_yearget_year(date)Returns the year from a date.get_year(2025-01-15)2025
get_day_of_weekget_day_of_week(date)Returns the name of the day of the week.get_day_of_week(2025-01-15)Wednesday
start_of_monthstart_of_month(date)Returns the first day of the same month.start_of_month(2025-01-15)Jan 01, 2025
end_of_monthend_of_month(date)Returns the last day of the same month.end_of_month(2025-01-15)Jan 31, 2025
convert_timezoneconvert_timezone(date; timezone)Converts a date and time from one timezone to another.convert_timezone(2025-01-15T14:30:00Z; America/New_York)Jan 15, 9:30 AM EST
nownow()Returns the current date and time at the moment the flow runs.now()2025-01-15T14:30:00Z
todaytoday()Returns today's date with no time attached.today()2025-01-15
to_dateto_date(text)Turns a text value into a proper date the flow can work with.to_date(January 15, 2025)2025-01-15T00:00:00Z

List

Functions for working with collections (arrays of items).

FunctionSignatureDescriptionExample
filter_listfilter_list(list; field; value)Keeps only the items where a field matches a value.filter_list(tickets; status; open)[3 of 10 items]
sort_listsort_list(list; field; order)Sorts a list from highest to lowest, or A to Z, by a field.sort_list(orders; amount; desc)[sorted: 500, 200, 50]
pluckpluck(list; field)Picks one field out of every item in a list.pluck(users; email)[[email protected], [email protected]]
join_listjoin_list(list; separator)Turns a list into a single piece of text with a separator.join_list([bug;urgent;backend]; ", ")bug, urgent, backend
first_itemfirst_item(list)Returns the first item in a list.first_item([apple;banana;cherry])apple
last_itemlast_item(list)Returns the last item in a list.last_item([apple;banana;cherry])cherry
item_atitem_at(list; index)Returns the item at a specific position in a list.item_at([apple;banana;cherry]; 1)banana
countcount(list)Counts how many items are in a list.count([bug;urgent;backend])3
sumsum(list; field)Adds up a number field across all items in a list.sum(orders; amount)4820.5
averageaverage(list; field)Calculates the average of a number field across all items.average(scores; value)82.4
max_in_listmax_in_list(list; field)Finds the highest value of a field across all items.max_in_list(orders; amount)1200
min_in_listmin_in_list(list; field)Finds the lowest value of a field across all items.min_in_list(orders; amount)9.99
deduplicatededuplicate(list; field)Removes items that have the same value in a field.deduplicate(leads; email)[7 of 10 items]
flattenflatten(list)Turns a list of lists into one flat list.flatten([[a;b];[c;d]])[a,b,c,d]
split_text_to_listsplit_text_to_list(text; separator)Turns a comma-separated text into a list of items.split_text_to_list(bug,urgent,backend; ",")[bug,urgent,backend]

Logic

Functions for conditionals, comparisons, and fallbacks.

FunctionSignatureDescriptionExample
ifif(condition; true_value; false_value)Returns one value if something is true, and another if it's not.if(1500 > 1000; High value; Standard)High value
if_emptyif_empty(value; fallback)Uses a fallback value if the field is empty.if_empty(""; No name)No name
if_nullif_null(value; fallback)Uses a fallback value if the field has no value at all.if_null(null; N/A)N/A
switchswitch(value; key1; result1; key2; result2; ...)Maps a value to another — like a lookup table written inline.switch(US; US; North America; DE; Europe)North America
is_emptyis_empty(value)Checks if a field has no value.is_empty("")TRUE
is_not_emptyis_not_empty(value)Checks if a field has any value in it.is_not_empty([email protected])TRUE
is_equalis_equal(value1; value2)Checks if two values are exactly the same.is_equal(active; active)TRUE
andand(condition1; condition2)Returns true only if both conditions are true at the same time.and(25 >= 18; US = US)TRUE
oror(condition1; condition2)Returns true if at least one of the conditions is true.or(standard = vip; 600 > 500)TRUE
notnot(condition)Flips a true to false, or a false to true.not(is_empty([email protected]))TRUE
coalescecoalesce(value1; value2; value3; ...)Returns the first field that has a value, skipping any empty ones.coalesce(""; John; User)John

Deprecated functions

No functions are currently deprecated. When a function gets replaced or scheduled for removal, it will appear here with the recommended replacement and the version it will be removed in. Saved flows that use a deprecated function keep running — the editor just shows a strikethrough badge to flag the issue.