← Home
🔥0 DAY
0 XP

Business Rule

A Business Rule is server-side script that runs when a record is queried, inserted, updated or deleted, timed as before, after, async or display.

Also searched as: before business rule, after business rule, async business rule.

In practice

Before rules change values on the record being saved without a second write. After rules act on other records once this one is committed. Async rules run through the scheduler for work that must not slow the transaction. Display rules pass server data to the client through g_scratchpad.

Example

A before update rule on incident that stamps a reopen count when state moves from Resolved back to In Progress.

// Before update — set the field, never call current.update()
if (previous.state == 6 && current.state == 2) {
  current.u_reopen_count = parseInt(current.u_reopen_count || 0, 10) + 1;
}

What interviewers check

The killer question is why current.update() inside a before rule is a bug — it recurses and writes twice.

Practise this topic

Related Automation terms