Skip to content

Basic Concepts

Updated pdexter 2024-01-29

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.

RulesetProcess

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.

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

As of Formbird v1.1.197, rulesets can and should be 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 now be specified for a single event on a template.