Skip to content

Glossary of Common Objects

ntf

The object ntf[^1] acts as a sort of global repository of standard objects, functions, states and variables used within Rulesets. Consider it a sort of global carry-bag.

It is passed to most functions within a ruleset, and its state persists over the lifecycle of a ruleset, so it is convenient to store objects and state variables against it.

[^1]: The name "ntf" originally stands for "Nools Template Fact", and is a hangover from early ruleset development using Nools Rule Engine library, which served the same purpose. Even though we no longer generally use Nools, we've kept the name.

ft3 (ntf.scope)

ft3 can be considered the general portable toolbox that contains the functions we use in rules.

By convention, we assign ft3 to ntf.scope early in a block of script,

var ft3 = ntf.scope;

so we might use its member functions with the shorthand "ft3.function-name", rather than typing "ntf.scope.function-name". It would be quite valid to do away with ft3 and just use ntf.scope everywhere in your script; in this documentation though, we will be using ft3 by convention, so at least be aware of where it comes from.

ft3 contains the following functions: * Formbird Application functions -- generic functions that are made available to rulesets from the application, eg

javascript ft3.enableField('widgetName', false); Developer defined functions/objects defined in the ruleset script (declared sibling to the ruleset* object), eg
```javascript { #include "JayRule Ruleset Overlay JS",

settings : {
    specialMode : true
},

doMySpecialThing : function() {
  alert('hi there');
},
...
ruleset : {
  ...
  ruleX : {
    ...
    ruleAction : function(ntf) {
      ...
      if (ft3.settings.specialMode) {
          ft3.doMySpecialThing();
      }
    }
  }
}

} ``` * #included functional objects and variables -- sourced from #included RulesetInclude documents. eg

    #include "JayRule Ruleset Overlay JS",
    #include "Basic Functions JS", // provides object 'basicFunctions' 

    ruleset : {
      ...
      ruleDoThingA : {
        ...
        ruleAction : function(ntf) {
          ...
          var isEarly = ft3.basicFunctions.datePrecedes(date1, date2); 
        }
      }
    }
    }
        ...