Skip to main content

Using Formulas in Clustdoc

Updated yesterday

Clustdoc allows you to create custom formulas to evaluate data inside a dossier.
Formulas can be used in features such as checks, automations, eligibility rules, and validations.

They are safe, read-only, and based on Clustdoc’s existing merged fields.

What is a formula?

A formula is a logical expression that:

  • uses merged fields (e.g. {FORM_FIELD_1234}, {CONTACT_EMAIL})

  • applies operators and functions

  • returns a result (true / false, number, or text)

Example

num({FORM_FIELD_AMOUNT}) > 1000 and contains({FORM_FIELD_COMPANY}, "Ltd")

How to create and use a formula?

In your process, go to the Formulas section and click on the button "Add a formula" and fill the required information.

In order to use your formula anywhere in the application, use the following merged field:

{FORMULA.identifier}

where identifier is your actual formula identifier

Using merged fields

You can use any merged field available in Clustdoc, exactly as you use them in emails or documents:

{FORM_FIELD_1234} {CONTACT_FIRSTNAME} {CONTACT_EMAIL}

Behind the scenes, Clustdoc automatically replaces these fields with their actual values from the dossier.

Operators

Arithmetic

+   -   *   /   %

Comparison

==   !=   >   >=   <   <=

Logical

and   or   not

Examples

{FORM_FIELD_AGE} >= 18
not isEmpty({FORM_FIELD_SIGNATURE})

Operators can be combined with functions and merged fields:

(num({FORM_FIELD_A}) + num({FORM_FIELD_B})) >= 100 and notEmpty({FORM_FIELD_SIGNATURE})

Functions

Type conversion

Function

Description

num(x)

Convert to number

str(x)

Convert to string

bool(x)

Convert to boolean

num({FORM_FIELD_AMOUNT}) >= 500

String functions

Function

Description

lower(x)

Lowercase

upper(x)

Uppercase

trim(x)

Remove spaces

contains(a,b)

Text contains

startsWith(a,b)

Starts with

endsWith(a,b)

Ends with

length(x)

Text length

contains(lower({CONTACT_EMAIL}), "@company.com")

Empty / presence checks

Function

Description

isEmpty(x)

Value is empty

notEmpty(x)

Value is present

notEmpty({FORM_FIELD_IBAN})

Numeric helpers

Function

Description

abs(x)

Absolute value

min(a,b)

Minimum

max(a,b)

Maximum

round(x)

Round

Conditional logic

You can create conditional formulas using the if() function:

if(condition, value_if_true, value_if_false)

Example:

if(num({FORM_FIELD_AMOUNT}) > 1000, "HIGH", "LOW")

Common examples

Check that a document is complete

notEmpty({FORM_FIELD_ID_CARD}) and notEmpty({FORM_FIELD_PROOF_OF_ADDRESS})

KYC amount threshold

num({FORM_FIELD_AMOUNT}) <= 10000

Company email validation

endsWith(lower({CONTACT_EMAIL}), "@company.com")

Error handling & validation

  • Formulas are validated when saved.

  • Invalid syntax or unsupported functions will be rejected.

  • Formulas never modify data — they only evaluate it.

Best practices

  • Merged fields usually resolve to strings. Always use num() when performing arithmetic or numeric comparisons

// risky

{FORM_FIELD_AMOUNT} > 1000

// correct

num({FORM_FIELD_AMOUNT}) > 1000

  • Use isEmpty() instead of == ""

  • Keep formulas simple and readable

Summary

Formulas in Clustdoc allow you to:

  • build advanced checks

  • automate decisions

  • reuse merged fields consistently

  • stay safe and auditable

They are designed to be powerful enough for advanced users, while remaining predictable and supportable.

Did this answer your question?