Maestro Business Rules

   MaestroThe UI design product.  |   Form Builder |  All versions This feature is related to all versions.

A Maestro business rule is JavaScript code that is invoked by different events occurring in a Maestro form. Business rules have access to some form data and can obtain more information from Journey Manager. Maestro allows you to create and configure business rules to use in your Maestro forms. Business rules can originate from any of the following sources: 

  • Maestro's core engine firing life-cycle events, load and pre-submit.
  • Visual components firing the standard rule types:
  • Responses from calls to dynamic data services
  • Custom rules defined by Native Components
  • Your own rule code calling Form.fireRule

When a rule is invoked, its JavaScript code receives parameter objects:

  1. data
    • for non-repeated items, this is the form data object which holds values for all form fields plus additional system-related data.
    • for repeated items, this is the repeating object instance which holds all sibling repeating values, including any nested repeats, plus other properties such as the current index, the repeated data object array and the parent item.
  2. item - Object holding the structure and definition of the form field including style and 'properties' properties, as well as repeat-aware getData and setData methods to get and set the form field's data.
  3. info - Object describing the event which triggered the rule, or the object returned from a success or failure call in a remote data handler.

In addition to the parameters, there is a local 'value' variable that is set to the specific field instance value in the form data object. The 'value' variable is repeat-aware, so it represents either the sole data value, or the indexed data value in a repeat. Changing 'value' does not change the form data object, so it can be considered read-only.

The rule execution context also exposes several other objects which contain API methods you can call. These objects include:

  • Form
  • Util
  • Calc
  • DynamicData

The Maestro Rule Editor provides a quick access to the full method API documentation. Click API Methods as shown below.

To learn how to create a rule, see Creating Rules.

If you experience issues with your created business rules, see debugging business rules.

Types of Maestro Business Rules

Maestro comes with several pre-configured business rules types: