Jetstack's code processor is the function library behind {=...} expressions. These functions let expressions do more than interpolate values. They can cast values, reshape arrays, read query results, inspect changes, build links, and access runtime providers such as trigger parameters or secrets.
Many important configuration points in Jetstack rely on these functions:
- property conditions
- default values and calculations
- query parameter defaults
- automation branching and payload construction
- canvas item configuration
- integration helpers
If you know what the function set actually exposes, you can write shorter and much more reliable expressions.
This page documents the functions registered in CodeProcessorProvider::getProcessor() and focuses on:
- the callable name used inside expressions
- the purpose of the function
- its parameters
- its return value
Per your requested scope, this page intentionally skips every function whose name starts with date_*.
The older date helpers that do not start with date_*, such as date, today, time, strtotime, dateDiff, formatDate, and compareDates, are still covered below because they remain part of the expression API.
Not every function is available in every expression runtime.
| Availability |
Meaning |
Always |
Registered in every code processor instance. |
Context |
Registered only when the processor has an ActiveResource context. |
Trigger |
Registered only when a trigger-parameters provider is present. |
Endpoint |
Registered only when a previous-endpoint provider is present. |
Global vars |
Registered only when a global-variable provider is present. |
Local vars |
Registered only when a local-variable provider is present. |
App params |
Registered only when an app-parameter provider is present. |
Secrets |
Registered only when a secrets provider is present. |
DataQuery provider required |
The function is registered, but it only works when a current DataQuery provider exists. |
¶ Basic And Casting
| Function |
Availability |
Purpose |
Parameters |
Returns |
get(value) |
Always |
Returns the provided value unchanged. |
value: any input. |
mixed |
getRaw(value) |
Always |
Low-level helper that marks a property lookup for raw-value resolution. |
value: usually a property key or path component. |
mixed marker value used by the resolver |
transformLiteral(value, literal) |
Always |
Ignores the first argument and returns the literal second argument unchanged. |
value: any input, literal: the value to return. |
mixed |
setVar(name, value) |
Always |
Stores a processor variable and returns the stored value. |
name: string variable name, value: any value. |
mixed |
toBool(value) |
Always |
Casts a value to boolean. |
value: any value. |
boolean |
toString(value) |
Always |
Casts a value to string. |
value: any value. |
string |
toInt(value) |
Always |
Casts a value to integer. |
value: any value. |
int |
toFloat(value) |
Always |
Casts a value to float. |
value: any value. |
float |
toArray(value) |
Always |
Casts a value to array. |
value: any value. |
array |
toObject(value) |
Always |
Casts a value to stdClass. |
value: any value. |
stdClass |
¶ Collections And Reshaping
| Function |
Availability |
Purpose |
Parameters |
Returns |
map(iterable, transform = "") |
Always |
Transforms iterable items using a dot-chain or a mapping object. In chain mode, each step resolves a property or calls a transform function. In mapping mode, each output field gets its own transform chain. |
iterable: any iterable value. transform: string chain such as owner.full_name, or an array/object map such as { "name": "owner.full_name", "status": "status.upper()" }. |
array |
range(start, end, step = 1) |
Always |
Builds a numeric or string range. |
start: string, int, or float. end: string, int, or float. step: int or float. |
array |
in_array(needle, haystack) |
Always |
Checks whether a value exists in an array. |
needle: any value. haystack: array. |
boolean |
concat(array) |
Always |
Joins array items into one string without a separator. |
array: array of strings. |
string |
join(separator, array) |
Always |
Joins array items with a separator. |
separator: string. array: array of strings. |
string |
arrayKeys(array) |
Always |
Returns the keys of an array. |
array: array. |
array |
arrayValues(array) |
Always |
Returns the values of an array. |
array: array. |
array |
arrayFirstValue(array) |
Always |
Returns the first value from an array. |
array: array. |
mixed |
arrayLastValue(array) |
Always |
Returns the last value from an array. |
array: array. |
mixed |
arrayShift(array) |
Always |
Removes and returns the first value. |
array: array. |
mixed |
arrayPop(array) |
Always |
Removes and returns the last value. |
array: array. |
mixed |
arrayShiftGetArray(array) |
Always |
Removes the first value and returns the remaining array. |
array: array. |
array |
arrayPopGetArray(array) |
Always |
Removes the last value and returns the remaining array. |
array: array. |
array |
arrayPush(array, ...values) |
Always |
Appends one or more values to the end of the array. |
array: array. values: variadic values to append. |
array |
arrayUnshift(array, ...values) |
Always |
Prepends one or more values to the start of the array. |
array: array. values: variadic values to prepend. |
array |
arrayGetKey(array, key) |
Always |
Returns a value by key from an array. |
array: array. key: string or number. |
mixed|null |
length(value) |
Always |
Returns string length for scalar values or item count for countable values. |
value: any value. |
number |
¶ Strings And Text Processing
| Function |
Availability |
Purpose |
Parameters |
Returns |
explode(separator, string, limit = PHP_INT_MAX) |
Always |
Splits a string by a separator. |
separator: string. string: string to split. limit: numeric split limit. |
string[] |
trim(string) |
Always |
Trims leading and trailing whitespace. |
string: input string. |
string |
removeHtmlTags(string) |
Always |
Removes HTML tags from text. |
string: input string. |
string |
upper(string) |
Always |
Converts a string to uppercase. |
string: input string. |
string |
lower(string) |
Always |
Converts a string to lowercase. |
string: input string. |
string |
firstUpper(string) |
Always |
Uppercases the first character. |
string: input string. |
string |
firstLower(string) |
Always |
Lowercases the first character. |
string: input string. |
string |
webalize(string) |
Always |
Converts text into a URL-safe or slug-like form using Nette's Strings::webalize(). |
string: input string. |
string |
firstNChars(text, count) |
Always |
Returns the first N characters of a string. |
text: string. count: number of characters. |
string |
lastNChars(text, count) |
Always |
Returns the last N characters of a string. |
text: string. count: number of characters. |
string |
startsWith(text, search) |
Always |
Checks whether text starts with a substring. |
text: string. search: string prefix. |
boolean |
endsWith(text, search) |
Always |
Checks whether text ends with a substring. |
text: string. search: string suffix. |
boolean |
contains(haystack, needle) |
Always |
Checks whether a string contains a substring or whether an array contains a value. It also supports arrays of ActiveResource values and can match by object ID or code property. |
haystack: string or array. needle: any value. |
boolean |
¶ Hashing, Encoding, And Randomness
| Function |
Availability |
Purpose |
Parameters |
Returns |
md5(string) |
Always |
Returns the MD5 hash of a string. |
string: input string. |
string |
sha1(string) |
Always |
Returns the SHA1 hash of a string. |
string: input string. |
string |
sha256(string) |
Always |
Returns the SHA256 hash of a string. |
string: input string. |
string |
base64_encode(string) |
Always |
Base64-encodes a string. |
string: input string. |
string |
base64_decode(string) |
Always |
Base64-decodes a string. |
string: encoded string. |
string |
random(length = 10, chars = "0-9a-z") |
Always |
Generates a random string using Nette's Random::generate(). |
length: desired length. chars: character pattern. |
string |
¶ Date And Time Helpers Not Starting With date_*
| Function |
Availability |
Purpose |
Parameters |
Returns |
date(format = "Y-m-d H:i:s", timestampOrDate = null) |
Always |
Formats the current time or a provided timestamp/date string using PHP date(). If the second argument is a non-numeric string, it is parsed through strtotime(). |
format: date format string. timestampOrDate: Unix timestamp, parseable date string, or null. |
string |
today() |
Always |
Returns today's date at 23:59:59. |
None. |
string |
time() |
Always |
Returns the current Unix timestamp. |
None. |
int |
strtotime(dateTime = "now", baseTimestamp = null) |
Always |
Parses a date/time string into a Unix timestamp. |
dateTime: parseable date string. baseTimestamp: optional base timestamp. |
int|false |
dateDiff(date1, date2, absolute = false) |
Always |
Returns a PHP DateInterval between two dates. Accepts strings, timestamps, or DateTimeInterface values. |
date1: first date. date2: second date. absolute: whether to force an absolute difference. |
DateInterval |
formatDate(date, format) |
Always |
Formats a date using a format string. Accepts strings, timestamps, or DateTimeInterface. |
date: date value. format: format string. |
string |
compareDates(date1, operator, date2 = "now") |
Always |
Compares two dates. Supports operators >, >=, <, <=, ==, within, withinMonth, and withinYear. |
date1: date string or timestamp. operator: comparison operator. date2: second date or reference date. |
boolean |
¶ ActiveResource And Change Tracking
| Function |
Availability |
Purpose |
Parameters |
Returns |
getTitle(activeResource = null) |
Always |
Returns the title property value of an ActiveResource. |
activeResource: ActiveResource or null. |
string|null |
export(activeResource = null, properties = null, useSystemNames = true) |
Always |
Exports raw data from an ActiveResource, optionally filtered to selected properties and optionally using system names. |
activeResource: ActiveResource or null. properties: array of property names/system names or null. useSystemNames: whether to export using system names. |
array|null |
hasChanged(changes, property = null) |
Always |
Checks whether a property changed. In trigger-aware flows, you can call hasChanged("status") and it will read the current changes object from trigger parameters. |
changes: either an ARChanges object or a property name. property: explicit property name when changes is passed explicitly. |
boolean|null |
isOnlyChange(changes, property = null) |
Always |
Checks whether only one specific property changed. Like hasChanged, it also supports shorthand trigger usage. |
changes: ARChanges or property name. property: explicit property when changes is provided directly. |
boolean|null |
changedFrom(changes, property, previousValue = null, strict = false) |
Always |
Checks whether a property changed from a specific previous value. In trigger shorthand, call changedFrom("status", "draft", true) and the function will resolve the trigger changes object automatically. |
changes: ARChanges or property name in shorthand mode. property: property name or previous value in shorthand mode. previousValue: expected old value. strict: strict comparison flag. |
boolean|null |
¶ Files And Payload Construction
| Function |
Availability |
Purpose |
Parameters |
Returns |
fileFromFile(filename, title = null) |
Always |
Creates a SimpleFile from a filesystem path. If no title is given, the basename of the file is used. |
filename: full or relative file path. title: optional title shown for the file. |
SimpleFile |
fileFromData(data, title) |
Always |
Creates a SimpleFile from raw data in memory. |
data: raw file contents. title: resulting file title/name. |
SimpleFile |
if(condition, ifTrue, ifFalse) |
Always |
Ternary-style helper. The exported function name is if, even though the internal method is ifElse. |
condition: any truthy/falsy value. ifTrue: value returned when truthy. ifFalse: value returned when falsy. |
mixed |
merge(...args) |
Always |
Merges arrays and objects into one object. Objects are converted to arrays of properties first. Non-array, non-object arguments are ignored. |
args: variadic arrays or objects. |
object |
object(...args) |
Always |
Builds one object by array_merge(...$args) and then converts the result to an object. |
args: variadic array fragments. |
object |
objectRaw(...pairs) |
Always |
Creates an object from a list of single-key arrays. |
pairs: arrays such as {"status":"open"} or {"owner":123}. |
object |
randomFromList(list) |
Always |
Returns a random item from an array, object property set, or traversable. |
list: array, object, or traversable. |
mixed|null |
jsonEncode(data) |
Always |
JSON-encodes a value. |
data: any value. |
string |
jsonDecode(json) |
Always |
Decodes a JSON string. |
json: JSON string. |
mixed |
toApiArray(object) |
Always |
Converts an object into an API-style array. For ActiveResource, it uses API processing; for files, it uses file API serialization; otherwise it casts to array. |
object: ActiveResource, File, or another object-like value. |
array |
| Function |
Availability |
Purpose |
Parameters |
Returns |
getDataQuery() |
DataQuery provider required |
Returns the current DataQuery instance. |
None. |
mixed |
dataQueryFetch(property = null) |
DataQuery provider required |
Fetches one value from the current DataQuery. |
property: optional property path/name. |
mixed|null |
dataQueryFetchObject() |
DataQuery provider required |
Fetches one object from the current DataQuery. |
None. |
object|null |
dataQueryFetchAll(path = null) |
DataQuery provider required |
Fetches all results from the current DataQuery. |
path: optional result path or property path. |
array|null |
dataQueryCount() |
DataQuery provider required |
Counts rows in the current DataQuery. |
None. |
int|null |
dataQueryMin(property) |
DataQuery provider required |
Returns the minimum value for a property over the current DataQuery. |
property: property name/path. |
mixed|null |
dataQueryMax(property) |
DataQuery provider required |
Returns the maximum value for a property over the current DataQuery. |
property: property name/path. |
mixed|null |
These are available only when the processor has an ActiveResource context.
| Function |
Availability |
Purpose |
Parameters |
Returns |
query(query, params = []) |
Context |
Runs an internal API query by name. |
query: query identifier. params: associative array of query parameters. |
SoopioResultSet |
queryCount(resultSet) |
Context |
Returns the count of a query result set. |
resultSet: SoopioResultSet. |
int |
queryFetchRow(resultSet, property = null) |
Context |
Fetches a single row or one property from a row. |
resultSet: SoopioResultSet. property: optional property name. |
mixed |
queryFetchObject(resultSet, cache = true) |
Context |
Fetches one object from a query result set. |
resultSet: SoopioResultSet. cache: cache flag for object fetch. |
object|null |
queryFetchRows(resultSet, path = null) |
Context |
Fetches all rows from a query result set. |
resultSet: SoopioResultSet. path: optional path selection. |
array |
queryFetchObjects(resultSet) |
Context |
Fetches all objects from a query result set. |
resultSet: SoopioResultSet. |
array |
¶ Context, User, Resource, And Links
These are also available only when the processor has an ActiveResource context.
| Function |
Availability |
Purpose |
Parameters |
Returns |
currentLink() |
Context |
Returns the current action link string, not a full absolute URL. |
None. |
string |
user(property = null) |
Context |
Returns the current user ActiveResource, or one property from that user. |
property: optional property name. |
ActiveResource|mixed|null |
resource(type, idOrData) |
Context |
Resolves an ActiveResource of the given type from an ID or inline data. |
type: target type name. idOrData: scalar ID/code, array, stdClass, or ArrayHash. |
ActiveResource|null |
objectShowLink(activeResource = null) |
Context |
Returns the full show URL for an ActiveResource. Returns an empty string if no valid resource is passed. |
activeResource: ActiveResource or null. |
string |
objectEditLink(activeResource = null) |
Context |
Returns the full edit URL for an ActiveResource. Returns an empty string if no valid resource is passed. |
activeResource: ActiveResource or null. |
string |
objectCopyLink(activeResource = null) |
Context |
Returns the full copy URL for an ActiveResource. Returns an empty string if no valid resource is passed. |
activeResource: ActiveResource or null. |
string |
objectCreateLink(activeResource = null) |
Context |
Returns the full create URL for an ActiveResource. Returns an empty string if no valid resource is passed. |
activeResource: ActiveResource or null. |
string |
objectDeleteLink(activeResource = null) |
Context |
Returns the full delete URL for an ActiveResource. Returns an empty string if no valid resource is passed. |
activeResource: ActiveResource or null. |
string |
objectActionLink(activeResource = null, action = null, args = []) |
Context |
Returns the full URL for a named object action. Returns an empty string if either the resource or action is missing. |
activeResource: ActiveResource or null. action: action name. args: optional action arguments as an array. |
string |
isLoginAs() |
Context |
Returns whether the current user is operating through a shadow-login session. |
None. |
boolean |
| Function |
Availability |
Purpose |
Parameters |
Returns |
trigger(name) |
Trigger |
Returns a trigger parameter by name. Commonly used in automations and change-driven flows. |
name: trigger parameter name. |
mixed |
endpoint(name) |
Endpoint |
Returns a parameter from the previous endpoint context. |
name: parameter name. |
mixed |
global(name) |
Global vars |
Returns a global variable. The exported function name is global, backed by the internal method globalVar. |
name: variable name. |
mixed |
var(name) |
Local vars |
Returns a local variable. The exported function name is var, backed by the internal method localVar. |
name: variable name. |
mixed |
appParameter(name) |
App params |
Returns an app parameter by name. |
name: parameter name. |
mixed |
selection() |
App params |
Shortcut for the app parameter named selection. |
None. |
mixed |
| Function |
Availability |
Purpose |
Parameters |
Returns |
getSecret(name) |
Secrets |
Reads a secret value from the secret store. |
name: secret name. |
mixed |
saveSecret(name, value, title = "", type = "string") |
Secrets |
Saves or updates a secret value. |
name: secret name. value: secret value. title: human-readable label. type: secret type. |
mixed |
removeSecret(name) |
Secrets |
Deletes a secret from the secret store. |
name: secret name. |
mixed |
These are the names you actually call in expressions:
- use
if(...), not ifElse(...)
- use
object(...), not objectMerge(...)
- use
global(...), not globalVar(...)
- use
var(...), not localVar(...)
Some functions look universal in the catalog, but they only work when their provider exists:
query*, currentLink, user, resource, and object*Link require a current ActiveResource context
trigger requires trigger parameters
endpoint requires a previous-endpoint provider
global and var require variable providers
appParameter and selection require app-parameter access
getSecret, saveSecret, and removeSecret require the secret-store provider
getDataQuery and the dataQuery* helpers require a current DataQuery provider
getRaw() is a low-level helper. It is useful when you intentionally need raw property values rather than the standard resolved value flow.
map() is powerful, but it becomes hard to maintain when the transform chain tries to do too much in one expression.
query() is convenient, but repeated query calls inside expressions can make configuration harder to reason about. Prefer explicit queries and typed configuration when possible.
- Secret functions are operationally powerful and should be used deliberately. See Secret Store.