Field expressions
Value expressions
Value expressions calculate the fields' value based on the provided expression. A value expression is a simple expression that results in a single value. If your field is a multi-value field, you need to return an array of items.
Refer to the Expressions for details on writing expressions.
Currently, you can only use values of the current record. References are not yet supported. If you need to reference data across multiple records, use automation scripts or workflows instead, |
The |
|
The |
|
A string or an array of strings with current field values. If the field name collides with any of the system-defined variables, access the value via the new["field_name_here"]. |
price * 1.25
trim(firstName + " " + lastName)
["foo", "bar", "baz"]
Sanitizers
Sanitisers modify the field value to cleanup (sanitise) the data before it is saved. A sanitiser is a simple expression that results in a single value.
Refer to the Expressions for details on writing expressions.
By their nature, sanitisers should not result in an error. If an error occurs, it is logged in the action log, and the operation continues.
If you define multiple sanitisers, they are run in the specified order.
length(value) > 5 ? substr(value, 0, 5) + "..." : value
The |
Validators
Validators validate the field value by raising errors when the value is not valid.
A validator is a simple expression that results in a single value, either true
or false
.
The value validation is considered invalid when the expression results in true
.
Validators can not change the value.
Built-in field validators can be disabled; required and unique-multi-value validators can not be disabled.
If you define multiple validators, they are run in the specified order.
The field validator stops when the first error occurs.
For example, if we define validators |
-
the value is not changed,
-
the value is missing.
Use the required flag to check for required values. |
The |
|
The |
|
The |
length(title) < 5