Skip to content

Basic Concepts

Updated pdexter 2024-06-05

What is a Ruleset

A ruleset is a block of script that interacts with the Formbird application in response to certain events.

The structure of a ruleset is basically a collection of "rules", which act as a "rules engine". Our system takes some concepts from Rules Engine theory, however this concept in total is quite challenging.


RuleSets are scripts, written in a form of Javascript or NodeJS which provide rule definitions to be processed on a given event of a document, or at a scheduled time. They are contained in their own "ruleset document".

The purpose of rulesets are to :

  • implement business rules against a document, and to a lesser extent, system rules

  • automate the modification of data, based on existing data

  • schedule actions that need to happen at a future date-time

  • generate further documents that may be required as a result of business rules

Rulesets are currently divided into server-side, and client-side processing, on the following events:

Server side

  • PreSaveServer Occurs before a document is saved; (Changes made to the document are reflected on the screen, if saved from screen)

  • PostSave Occurs after the document has saved.

  • Scheduled Occurs at a predefined time.

Client side

  • PreRender Occurs before the document loads.

  • OnLoad Occurs after the document is loaded

  • OnFieldChange Occurs after any field is changed (including keystrokes in text)

  • PreSave (Client) Occurs after the user clicks Save, but before the actual saving

  • PreDelete Occurs after the user clicks Delete, but before the actual deletion.

  • PostSave (Client) Occurs after a save has completed.

  • OnReceiveEvent Occurs when the document is saved elsewhere, and a push event has been received (Formbird v4.2.56 and later)

Both Server and Client side rulesets are stored in and run from their own documents.

Rulesets are linked to from the template. The ruleset links are specified in the template, rather than the template links being specified in the ruleset.

Multiple rulesets can be specified for a single event on a template.