Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Section
Column

Business rules are added by editing your form or workflow. Click the Rules icon in the form/flow designer toolbar to add new business rules or edit existing ones.

Image RemovedImage Added

provides two ways to create business rules:

  • Visual Rule Builder - visual wizards to help create your rule. The Visual Rule Builder provides access to the generated JavaScript in the Rule Validator for editing.
  • Rule Validator - canvas to type in JavaScript with tools to help form/flow designers write and debug rules.

Create a new rule by clicking on the icon. 

Each rule has two icons:

  • Click the  icon to choose the Visual Rule Builder or the Rule Validator canvas to add a new rule or edit an existing one.
  • Your new rule is given a randomly generated name. Change the name and description to describe the rule function.
  • Rules are enabled by default. They can be temporarily disabled by unchecking the Enabled checkbox.
  • Click the Run Builder button to open the Visual Rule Builder (Click the link to find out more information about the wizard) or the Rule Code button (Click the Rule Code link for details about the Rule Validator) to enter the JavaScript directly. 
  • Click the icon to delete a rule. Confirm your choice in the dialog that pops up and the rule will be immediately removed. This is an irreversible process so make sure you do not need the rule before you delete it.
  • Click the Image Modified to test your rule without leaving the Rule Editor
  • Click the View All link to see a readonly list of all the rules in your form/flow.

Image Added

Refer to Rules Examples for many real world samples.

Column
width340px

 On this page:

Table of Contents
maxLevel5

...

  • form.load : This event is occurs when a form or workflow step loads for the first time. It is useful for setting default values via rules that you need to be set before the user starts interacting with the form. 
  • form.unload : This event is true when users click the form's Submit or a flow's Continue button. It is useful for setting control values just prior to the execution of the form's Doc Actions and Form Actions. If you have a rule in your form that changes any control(s) after clicking Submit, thereby making the form invalid, the form will no longer be submitted and the invalid form will redisplay. Form and Document actions will not execute,  PDFs are not generated, invalid controls become highlighted as expected and form.unload output displays in the debug console. This prevents an invalid xml for a successful submission from being created and only applies to forms.
  • form.positionUpdated : This event is used for the Geo location feature. You can fire a rule using this special identifier every time the position is updated.
  • form.activate: This event indicates that a flow has navigated to a step. If form.activate is true, the workflow just moved to a step. Use the _data.getParameter to determine what step that is.
  • form.deactivate:  This event indicates that a flow has left a step. If form.deactivate is true, the workflow just left a step. Use the _data.getParameter to determine what step that is.

form.load vs form.activate

...

The Form Outline is only visible when you toggle to the business rules designer view. When you toggle back to the form designer canvas view the Form Outline is hidden.

Image RemovedImage Added

At first the form outline will be collapsed. Click the "+" on the top level form icon to begin expanding the outline. The icons are indicative of the control's type. See the LoanDate control displays a calendar icon and the LoanNumber is a quantity control. The BorrowerInformation, LoanTerms and SubjectPropertyInformation controls are section types. You can click the icon to copy a control name from the outline. The image below shows the light box that displays and prompts you to copy the control name to the clipboard via Ctrl C or Command C. From the clipboard, you can paste it into your rule. This is a great way to avoid typo mistakes.

...

Info

See the FAQ - Business Rules topic for additional important information and known limitations with rules in the current release.

Save and Test

Rule Validator

The first step in debugging your rule is to correct all errors caught by the rule validator. The validator executes automatically as soon as you leave a rule input window either by tabbing out of the input, clicking away from the rule to the control view, clicking the form designer finish button, etc... All rules with errors are highlighted in red. If you click finish to save your changes while there are invalid rules, you will be prompted to save with errors.

...

When you are designing a form/flow with many objects and a lot of business rules, reduce the number of page reloads when switching between the designer view, rules view, and the test view by clicking the Image Added save and test icon. Save and Test checks for Rule errors before the test popup displays. If rule validation errors are detected, the designer is notified and given the option to correct before the Test popup is displayed.

Image Added

If you clicked the save and test icon from the Rules page, clicking Cancel on a Rule Validation Failure message returns to the Rules page where you can make changes. Clicking Ok proceeds to the Test popup. Refer to Testing Forms and Testing Workflows for more information.

Rule Validator

The first step in debugging your rule is to correct all errors caught by the rule validator. The validator executes automatically as soon as you leave a rule input window either by tabbing out of the input, clicking away from the rule to the control view, clicking the form designer finish button, etc... All rules with errors are highlighted in red. If you click finish to save your changes while there are invalid rules, you will be prompted to save with errors.

Note

Not all errors can be detected by the rule validator. It is still very important to test your use mode forms. Use the debug console described in the next topic to test for and solve runtime errors.

Here is an example of a validation error. Note the red background and the validator information displayed below the rule. In this case the control name was mistyped as Yourage when the name is actually YourAge. Remember that control names are case sensitive. So Yourage is not the same as YourAge with a capital A. 

...

The validator also supports global directives. Use the global directive to identify additional global objects and functions defined in the execution environment and made available to the rule for which it is not appropriate to include a var statement in the rule code itself. One directive can be used to list all additional globals on a single line. Currently there are no known cases requiring the use of the global directive.  

 

Rule Editor Functions

The Rule Validator includes an enhanced editor designed to provide an easy experience when developing rules.The rule editor box includes the following features:  

FeaturesDescription
Line NumbersLine numbers in the rule code editor make it easier to correlate reported validation errors with the line of code.
Bracket auto closeType a {, ( or [ and the closing bracket is automatically inserted.
Match BracketPlace the cursor on a bracket and both it and the matching bracket are shown in a matching distinctive color (green).
Syntax Hi-lightingJavaScript syntax hi-lighting with keywords, variables, comments, etc. shown in distinctive colors.
Auto IndentNew lines are auto-indented according to generally accepted code formatting rules.
Code FoldingBracketed code blocks (functions, if-then-else blocks, etc.) are collapsible. Click the arrow immediately to the right of the line numbers to collapse/expand code blocks.
Full screen edit mode

Expand the editor to full screen mode if you need more space to work. Click the "double arrow" expand icon (directly above the editor box) or press F2 when your cursor is inside the Rule box to expand to full screen. The ESC key returns you to small window mode.

Auto Complete/HintingWhen composing a rule, the designer can pick from a list of available controls and their properties directly within the rule editor. The pick list is context sensitive and will behave differently based on where the cursor is located when it is invoked. When on a blank space or immediately following an open bracket/brace, it can be manually invoked using Ctrl-Space to bring up a list of controls. Typing a dot (.) immediately after a  control name or after the index ("[i]") that follows a control name will automatically bring up a context sensitive pick list of properties applicable to that control for selection. You can type the first letter of the item you are looking for and the property starting with that character will be highlighted in the list. Continue typing and the matching options will progressively narrow to the characters typed. Double click your choice using the mouse or press the Enter key to select an item. Any other key dismisses the pick list. . See the example below
HelpThe help icon displays a small help window listing the hot keys described above - (F2, ESC and Ctrl-Space)

...

Of course, you can still use the Form Outline to help you when composing rules.

Info

JavaScript manually entered into the Rules Editor is not autoformatted. JavaScript "beatification is only applied to rules created with the Visual Rule Builder. 

 

 

 

Debug Console

The debug console can help you quickly solve runtime problems in your business rules. The debug console is enabled by appending the URL parameter &parameters _test=true and embed=true to a form's share URL. A form's or flow's test button automatically adds the &_test=true parameter so you do not have to append the parameter manually. The debug console appears below the form. If your form is long, scroll down to view the debug console.

Image Removed

The debug console will only appear for users that have the special Here is an example of the Share URL (Link/Email/Web) that will display the debug console for the form in the image when browsed. Note the _test=true is preceded by a ? to separate the form/flow URL from the parameters. Subsequent parameters, such as the embed-true parameter, are preceded by the & to separate the parameters from each other. Refer to Parameter Separators in URLS for more information about this syntax.

Code Block
https://app.frevvo.com/frevvo/web/tn/mycompany/u/8aa27da6-4bef-427c-92e3-6ad8d58e506a/app/_QDidgGGwEeeZjNWktbplXA/formtype/_tZmTYFf-EeeDC8g6jZAQlw/popupform?_test=true&embed=true

Image Added

The debug console will only appear for users that have the special frevvo.Designer role. If a user without frevvo.Designer role appends the &_test=true URL nothing will happen, no debug console will become visible. This protects the designer's rule code from accidentally becoming visible to normal form/flow users.

...

  • START - signals the start of an execution that may span one or more rules and Doc URIs 
  • END - signals the end of the execution of a batch of one or more rules plus the total execution time in milliseconds
  • ERROR - any errors that were thrown NOT in the context of executing rules
  • START_RULE - signals the start of a rule execution
  • END_RULE - signals the end of a rule execution plus the execution time of this one rule in milliseconds
  • RULE_ERROR - any errors that happened while executing the specific rule
  • RULE_EVAL - A message displaying the rule script
  • RULE_DEP - one for each rule dependency. Examples of dependencies are: form.load, trigger clicked, if conditions that trigger rules, control values changes on the right hand side of assignments, etc..
  • RULE_SCHEDULE - shows the next rule to execute and the remaining rules in the agenda/batch. This event makes it a bit easier to track what the rules engine is doing when debugging.
  • PROPERTY_SET - one for each control property set by the current rule
  • HTTP_START - signals the start of an http call (get, put, ...)
  • HTTP_END - signals the end of the http call + status code and timing
  • HTTP_RESPONSE - a message that dumps the first few lines of the http response
  • HTTP_ERROR - any errors that may have been thrown while performing the http call
  • DOC_READ_START - signals the start of a manually set Doc URI read
  • DOC_READ_END - signals the end of a manually set Doc URI read
  • DOC_READ - signals the success or failure of the Doc URI read
  • LOG - a user defined message that can be generated from a rule using frevvo.log('my INFO message') or frevvo.log('DEBUG', 'my debug message')
  • INFO - this statement informs the designer when the set of property values in a flow during form state initialization are ignored.
  •  WEB_SERVICE - events to report the URL and XML/JSON results when dynamically populating selection control (Dropdown, Checkbox, Radio and ComboBox) options from a RESTful web service
Dynamic Options Logging

Populating a selection control (Dropdown, Checkbox, Radio, ComboBox) using the Dynamic Options feature, requires the designer to examine the returned results from an entry point to determine bind paths, troubleshoot end point urls, etc. To assist the designer when developing forms/flows with controls that use this feature debug console logging includes Web Service events such as:

  • The web service call being made with fully the resolved end point URL shown
  • The web service data retrieved (JSON/XML)
  • Any errors received upon calling the web service.

Refer to the Dynamic Options topic for an explanation of this feature and examples of how these web service events in the debug console assist the designer.

Custom Output

This example shows a CUSTOM event. These events are created by adding frevvo.log() calls to your rules. Custom log messages are useful when you need even more debugging output. See Custom Logging for more details.

...

Follow these important points when writing your rule:

  1. Your rule can set minOccurs to 0 even if the design time setting > 0, but you cannot set minOccurs to a value which is greater than the current maxOccurs.  

  2. Your rule can set maxOccurs to a value that exceeds the design time setting, but you cannot set maxOccurs to a value below the current minOccurs value.

  3. Repeat items and table rows are added if your rule increases the Min# property and are removed when the rule decreases the Max#.

  4. Added rows due to increase in Min# will trigger the itemAdded property. 
  5. This feature can be used for schema controls, but min/maxOccurs values have to be set within the limit given in the schema. For example, if the schema has text control defined with minOccurs=2 and maxOccurs=100. We cannot set minOccurs less than 2 and max greater than 100.

...

Security Subject Information from LDAP

LDAP supports both the standard subject attributes and custom attributes. When a user is successfully authenticated by the LDAP security manager, Live Forms automatically retrieves Last Name, First Name and Email Address for this user from the LDAP server. You can retrieve custom attributes in addition to the standard ones from Active Directory and pull the data into your form/flow using  business rules. 

...

Attributes with more than one value are also supported. For example, The carLicense attribute can return multiple licenses. You can write a rule to populate dropdown options with those values. Make sure the carLicense attribute is added to the custom field on the LDAP Configuration screen and of course, there are multiple carLicense attributes, each one containing a different value for the dropdown options, set up for appropriate users on the LDAP server.

...

Note

The manager attribute maps to the built-in data - subject.reports. to. This means you can retrieve this value in a rule or use subject.reports.to for flow navigation if you configure the manager attribute in your LDAP tenant.

Execute a Rule on a Specified Workflow Step

...

Click the View All button to display all the rules in your form/flow. Then use a browser search (Ctrl+F) to highlight all the places in your rules where a particular search item is mentioned. For example, if you were looking for all the rules that set the required property for a section, search for  'SectionName.required' (replace SectionName with the name of your section ) . This view might be helpful when correcting errors reported by the Rules Editor.

...