Skip to content

Editing Rulesets

Ruleset scripts can be edited within FieldTec system itself, using the following RuleSet Template.

RulesetEditorScreen

Ruleset Security

The following security key has been applied to the ruleset template in most environments, and is envisaged to be a permanent part of the ruleset system. In those cases, this entry should be added to the user's account document's accessKeys array, where it is required for the user to have editing access to rulesets:

       {
            "keyId": "8b81b585-256e-adb3-4787-6a34cdf4d70b",
            "rights": [
                "Create",
                "Read",
                "Update",
                "Delete"
            ],
            "comment": "// TA Master Ruleset Key"
        },

Suggested Name (Object Event Descriptor) format

The following format is the recommended way to name the Ruleset (via the Name/Object Event Descriptor field).

{App Acronym}-{businessType}-[General|{SpecificName}]-{Event}

where {App Acronym} = The client application acronym, eg "CGD" {businessType} = The general type of the document, eg "Inspection" {SpecificName} = The specific document/template name, eg "Journey Management Task" or "JMTask" {Event} = The event or scheduled action name being processed, eg "OnLoad"

Examples

CGD-Inspection-General-OnLoad

NRC-MonitoringTask-JMTask-OnFieldChange

Structure of a Ruleset Script

For this edition of the Ruleset Development Guide it is encouraged to use the "JayRule" method/format of scripting.

To implement JayRule simply include the RuleSetInclude "JayRule Ruleset Overlay JS" at the top of your ruleset, then define the "ruleset" object below this, thus:

{
#include "JayRule Ruleset Overlay JS",

    ruleset : {

        name : 'name-of-ruleset',

        rule-name : {
            runCondition : run-condition-function,

            runAction : run-action-function
        },

        rule-name : { 
            ...
        }, 
        ...
    }
}

If your environment doesn't have the rulesetInclude "JayRule Ruleset Overlay JS", see FieldTec (pd) for latest version.

RuleSet Includes

Common RuleSet scripting can be saved to a RuleSet Include document, and then included into a ruleset.

Eg

#include "Basic Functions JS",

placed inside the first open bracket of the script (eg the line after #include "JayRule Ruleset Overlay",)

See Creating and Using RulesetIncludes.