Editing Rulesets (Ruleset MSV Editor)
Updated pdexter 2022-10-22
Ruleset scripts can be edited within the Formbird system itself, using the following RuleSet Editor (Ruleset Editor MSV).
MSV stands for "Multi Section Version", to differentiate it from the original Ruleset Editor
This alternative editor is useful where a ruleset becomes very large and needs to be "sectioned" for maintainability.
Several "Ruleset Sections" can be defined, each containing a number of rules that pertain to that section's purpose.
The Ruleset MSV Editor also enables defined settings using fields on the screen rather than defining properties of the script object. These include "name", "logging" (various parameters), timeout, and ruleset includes.
On saving, the editor compiles all the settings and script sections into a single ruleSetDSL, which can be viewed in the original editor, if desired.
CAVEAT - This ruleset editor is only valid for rulesets structured as JayRule rulesets; it will not work with older style rulesets.
Ruleset Editor MSV has its own template, whose documents take the systemHeader.systemType of "ruleset".
The template ID is 5d8db6a0-3811-11eb-976c-8df05452da03
|Log Prefix||Sets the prefix of any logging to the console log, or for server side rulesets, to the server log, in order to be able to distinguish it from other loggings.
Defaults to "RSLog:"
|Log Emailee||The login email address of the user for which server side logging emails should be sent. In general, only if that user is the logged in user which evokes a process that calls the ruleset will an email be sent.|
|Log Email All||Sets whether to send a log email to the Log Emailee regardless of which user the ruleset is running under.|
|Stop Email After Date||If set, stops debug emails being set after this date. The developer can set this to receive debug emails for a limited time only.|
Link to Templates
This section shows what Templates and Schedules use this Ruleset, and allows the developer to link target templates to this ruleset for particular events.
The ruleset link will be at the end of any other links the template already has.
Settings are not saved to the Ruleset MSV document. This updates the target Template documents.
Here you can select ruleset includes to be included in your ruleset (rather than having to remember names of rulesetIncludes, as for the original Ruleset Editor).
The rulesetInclude "JayRule Ruleset Overlay JS" is automatically added in this editor and does not need to be selected again.
See also Creating and Using RulesetIncludes.
Shared Functions & Parameters
Here you can define functions and parameters that are to be used throughout the ruleset, within all ruleset sections.
In the later ruleset sections, they can be accessed by ft3.functionName or ft3.variable
Here is a list of ruleset sections defined for the ruleset.
Each ruleset section contains simply a collection of rules that pertain to that section. There is no need to nest them within a "ruleset" object.
The ruleset sections are run in order of appearance within the list.
|Rule Index button||Presents a full index of all rules within the ruleset entire, and the section to which they belong.
Selecting one and clicking OK will open that ruleset section.
|Section Name||The name of the section.|
|Active (checkbox)||Sets whether to compile this ruleset section into the final ruleset.
Sections can be defined but left inactive such that they are not processed. They will be omitted from the final saved ruleSetDSL script.
|Place After||Dropdown contains a list of all other ruleset sections.
If set, moves the ruleset section within the sequence of sections, to come after the specified other ruleset section, on saving.
|Delete Section (button)||Deletes the ruleset section altogether.|
|Test Section (button)||Performs a simple parsing test of the ruleset section script, to ensure that is syntactically correct.|
Converting from regular rulesets
NOTE - At present moment it is advised not to use the built in conversion via Ruleset MSV overlay (if available).
Instead, create a new Ruleset MSV document, and copy rules in by hand; templates can then be relinked to the new ruleset by manual editing, or running a tailored DirectScript.
~~Other rulesets can be opened in the Ruleset MSV Editor by appending the following to the url of the ruleset~~
~~A bookmarklet can be defined on your browser bookmarks to do this automatically; set the following URL on a new bookmark :~~
~~The Ruleset MSV template will extract all the settings within the ruleset script and set the form fields accordingly.~~
~~The original ruleSetDSL will be copied into a ruleset section called "(old ruleset script)", set inactive, so that the developer can copy rules out to other new ruleset sections at their convenience.~~
~~WARNING -- if you save the document at this point, before the script is converted into ruleset sections, the operative ruleSetDSL script will be overwritten by the compiled ruleset script, probably in a non working state.~~
~~You will need to be prepared for the ruleset to "not work", for the time it takes to do the manual redistribution of rules.~~
~~An alternative approach, of course, is to create a completely new Ruleset MSV document and to copy between two completely separate ruleset documents; this would then involve having to change all ruleset links on target templates.~~
~~A checkbox "Convert to MSV" can be clicked, then the ruleset saved, and the ruleset will become an actual Ruleset MSV (change to template).~~
] : #