Stop bad data with the Rule Book
Before you start
The Rule Book holds checks that run right before a record is saved. Use it for rules that involve more than one field or a calculation, such as “a contract’s value must be above zero” or “an invoice date must fall within its service period”. A rule either warns the person or stops the save.
Add a rule
Section titled “Add a rule”- Click Form rules in the toolbar of the Form builder.
- Scroll to Rule Book and click Add Rule. The Rule Book Entry dialog opens.
- Type a Rule Code, for example
CON-001. - Choose a Severity: Warning (user can proceed) or Block (hard stop).
- Type a Rule Name, for example
Contract value above zero. - Type the Decision Message, the sentence people read when the rule fails.
- Write the Script. It must pass only when it evaluates to true.
- Click Save Rule, then Save in the panel and Save on the form.
Each rule in the list shows its code, its name and its severity. A switch turns the rule on or off. The pencil edits it and the bin removes it.
How do I write the script?
Section titled “How do I write the script?”Rules are written in Smart ScriptSmart ScriptBeezr's scripting language (engine name Beezl) used in fields, rules, filters, workflow values and dashboards.Open glossary ↗. The rule passes when the script evaluates to true. Anything else, including false or an empty result, fails it.
Write one expression that evaluates to true or false, without return.
parseFloat($cm_contracts$.$contract_value$) > 0Use the full $table$.$field$ token for each field. Press Ctrl + Space in the editor for suggestions. Wrap numbers in parseFloat or parseInt before you compare or add them.
What do people see when a rule fails?
Section titled “What do people see when a rule fails?”When someone saves a record in App space, Beezr first checks the required fields. Then it runs every rule that is switched on and has a script. If any rule fails, a Rule Book Check dialog opens with “The following rules require your attention before saving.”
- Rules with Block severity are listed under Blocked. Click Close to return to the form.
- Rules with Warning severity are listed under Warning. If there are no blocks, a Proceed Anyway button saves the record regardless.
The dialog shows each rule’s code, name and Decision Message.
What should I know before I start?
Section titled “What should I know before I start?”- Test every new rule with a sample record. A script that throws an error counts as a Block and shows the error text.
- Give every rule its own Rule Code. Beezr identifies a rule by its code, with symbols replaced by underscores. Two rules with the same code overwrite each other’s result.
- Fill in Rule Code and Rule Name (marked *), and give every rule its own code.
- Rules run when someone saves on the add or edit form in App space.
- A rule runs when its switch is on and it has a script.
Check yourself
What's next
Last checked