Docs‎ > ‎Reference‎ > ‎

Rules syntax

Formulas, validations and event rules are simply JavaScript 1.8 code.  

Important:  ====> context variables are described here.


A formula must return a value which is appropriate for its column. For instance, a formula for a string column must return a string. Numeric types are automatically converted as needed.

If a formula returns nothing, then the value of the column is unchanged:
if (row.value > 1000) // Do not change

Example 1:

return (row.price * row.quantity) * 1.1;

Example 2:

var basePrice = row.price *;
if (basePrice >
    return basePrice *;
    return basePrice;

Formulas can access the values of the current row, and the old row, as well as the current values of parent rows. They must not access the values of grandparent rows.


Validation rules must evaluate to a boolean value. If a validation rule does not return a boolean value, an error will result.
Like formulas, validations can access the values of the current row, the old row, and any parent rows.

Example 1:

return row.balance <= row.credit_limit;

Example 2:

// Small balances are always OK
if (balance < 10)
    return true;
// We can't accept huge balances
if (balance > 1000000)
    return false;
// We do not accept large increases
if (logicContext.verb == "UPDATE" && row.balance/oldRow.balance > 2)
    return false;
// Now see if the balance is acceptable, depending on whether the company has preferred status
var limit =;
var fuzzyFactor = ? 1.1 : 1.0;
return row.balance <= limit * fuzzyFactor;


Events (and their close cousins Early Events and Commit Events) are simply JavaScript that gets executed whenever a row is inserted, updated or deleted (assuming the rule is enabled for that type of event).

Events do not have to return any value -- if they do, that value will be ignored.

Like formulas and validations, events can access the values of the current row, the old row, and any parent rows.