|
Business Rules are executed under the following conditions:
If you want your rule to run Only when the form loads - check the Initialization Only checkbox at the top of the wizard. Typically, you would check this if there is some business logic that you want to to execute before the form/flow displays and users begin interacting with it.
When the rule displays in the Rule Builder tab, it will indicate that the rule has been flagged to run only when the form loads, if this checkbox is checked. This feature will be helpful for creating rules in future versions of the Visual Rule Builder.
The Rule Builder walks you thru three easy steps to define your condition and actions.
Describe the conditions under which a set of actions should be executed. You can specify more than one condition in the same rule but you do not need a condition.
Each condition consists of the following:
Part | Description |
---|---|
Field or current step (Optional) | What field or current workflow step do you want to evaluate?
|
Operator | What condition do you want to test to see if it is true? Select to from the choices to use an expression or function in your rule |
Value (Optional) | What value do you want to compare the Field or current step to? What function/operator do you want to use to build the expression? |
The following functions are available in the Rule Builder for building expressions. Function names may be entered in any case (case insensitive).
Functions are entered into the Enter an Expression field in the wizards.
This field has two modes:
Lookup mode displays functions and controls from your form/flow. The functions matching the typed text are displayed first followed by the form/flow controls.
Lookup Mode is triggered as you enter text in the Value fields of the wizards.
Help mode sows help text for the function in the dropdown area. The help information includes:
Use these operators to build useful expressions
Declare the actions that should be taken when the condition is true. The Functions/Operators listed above can also be selected as the value in this wizard.
Declare the actions that should be taken when the condition is false. The Functions/Operators listed above can also be selected as the value in this wizard. Else Actions are optional as not all rules require them. You cannot add FALSE actions if you do not have a condition specified in the rule.
Select the Value, expression or function(optional). To enter a text value, slide the toggle switch icon to the right and a field displays to the right.
If current step is selected as the condition for a workflow designed using Linked Steps, the value dropdown displays the names of the linked steps as choices. Workflows designed with individual forms as steps (not linked) will only show that step in the current step value dropdown. For example,
|
Once completed, the entire rule can be viewed in the Rule Builder tab.
|
The Rule Builder allows you to create a rule that has more than one condition. You can write a rule that performs actions based on the values of more than one field. As you select conditions, a logic expression is built and displayed at the bottom of the screen. Notice the expression uses the AND operation by default. There may be business rules that require a change to the logic expression.
A Travel Request workflow contains a field where the user selects a destination country from a dropdown. Countries that call their subdivisions "states" are: United States, Mexico, Australia, Brazil, India, Germany and Myanmar. The business requirement for this rule is: If any of these countries are selected, a Destination State field is enabled so the user can enter the Destination state. Otherwise, the Destination State field is disabled. The Condition wizard for the business rule is shown in the image. Note that each condition is assigned a color coded number that is reflected in the logic expression. The logic expression is built with the and operator by default. Since we want the rule to execute when any of the conditions are true, we must change all the and operations in the logic expression to the or operation. |
Rules created with the Rule Builder are automatically converted to JavaScript and co-exist with existing JavaScript rules. Of course, you can still add JavaScript directly or edit the generated code to make manual changes to your rule once you have created it with the Rule Builder.
Clicking the Edit Code button permanently disables the Rule Builder for this rule. |
This is version 1 of the Rule Builder. More common rule patterns will be available in future releases.
This version of the Visual Rule Builder does not currently support screenflows that use the Navigation toolbar to move back and forth between screenflow steps. |
Example 1:You are designing a weekly Time Sheet that has fields where the user must enter the From and To dates for the reporting period. Rule Requirement: If the date entered in Period To is equal to or earlier than the date entered in Period From field show this error message "Must be after From Date" The Condition and Action wizards for this rule are show in the image. This is how the rule displays in the Rule Builder tab. If the user enters 3/7/2017 or a date before 3/7/2017 in the Period To field the error message displays. |
Let's take a look at a simple example. Imagine a form with 3 fields named Name, Status and Money. Rule Requirement: If the Name field contains "John" and the Status field contains "satisfied" then populate the Money field with 50000.00 else populate the Money field with 1000.00. One way to write this rule in JavaScript is to use nested if statements:
If you are using the Visual Rule Builder to achieve the same result, you will have to add two rules:
|