Basic Syntax
Formulas in AutoCRM use a simple expression language for calculations and data transformations.
Arithmetic Operations
amount * quantity
(price - discount) * 1.21
String Operations
string\concatenate(firstName, ' ', lastName)
string\upperCase(name)
string\substring(code, 0, 3)
Conditions
ifThenElse(
status == 'Active',
'Active',
'Inactive'
)
Available Functions
String Functions
| Function |
Description |
Example |
string\concatenate(...) |
Concatenate strings |
string\concatenate(a, b) |
string\substring(s, start, len) |
Substring |
string\substring(s, 0, 5) |
string\upperCase(s) |
Uppercase |
string\upperCase(name) |
string\lowerCase(s) |
Lowercase |
string\lowerCase(name) |
string\trim(s) |
Trim whitespace |
string\trim(text) |
string\length(s) |
String length |
string\length(name) |
string\contains(s, needle) |
Contains |
string\contains(name, 'CRM') |
Numeric Functions
| Function |
Description |
Example |
number\format(n, decimals) |
Formatting |
number\format(price, 2) |
number\round(n, precision) |
Rounding |
number\round(amount, 0) |
number\floor(n) |
Floor |
number\floor(value) |
number\ceil(n) |
Ceiling |
number\ceil(value) |
number\abs(n) |
Absolute value |
number\abs(difference) |
Date Functions
| Function |
Description |
Example |
datetime\now() |
Current time |
datetime\now() |
datetime\today() |
Today's date |
datetime\today() |
datetime\format(d, format) |
Formatting |
datetime\format(date, 'YYYY-MM-DD') |
datetime\addDays(d, n) |
Add days |
datetime\addDays(date, 7) |
datetime\addMonths(d, n) |
Add months |
datetime\addMonths(date, 1) |
datetime\diff(d1, d2, unit) |
Difference |
datetime\diff(start, end, 'days') |
Logical Functions
| Function |
Description |
Example |
ifThen(cond, val) |
If-then |
ifThen(active, 'Yes') |
ifThenElse(cond, val1, val2) |
If-then-else |
ifThenElse(active, 'Yes', 'No') |
or(a, b) |
Or |
or(condition1, condition2) |
and(a, b) |
And |
and(condition1, condition2) |
not(a) |
Negation |
not(isActive) |
Entity Functions
| Function |
Description |
Example |
entity\attribute(link, attr) |
Linked entity attribute |
entity\attribute(account, 'name') |
entity\attributeFetched(link, attr) |
Fetched attribute |
entity\attributeFetched(contact, 'email') |
entity\isNew() |
Is new record |
entity\isNew() |
entity\isAttributeChanged(attr) |
Attribute changed |
entity\isAttributeChanged('status') |
Calculate Total Price
amount * quantity * (1 - discount / 100)
Automatic Record Name
string\concatenate(
accountName,
' - ',
datetime\format(createdAt, 'YYYY-MM')
)
Conditional Setting
ifThenElse(
probability >= 80,
'High',
ifThenElse(
probability >= 50,
'Medium',
'Low'
)
)
Due Date Calculation
datetime\addDays(
createdAt,
ifThenElse(priority == 'Urgent', 1, 7)
)