Creating your First Rule

Last Updated: 07/29/2016 Introduced in Verision: 2.0

 

A Rule evaluates input data to determine whether the data matches certain conditions. The rule returns the outcome, then passes this information to a flow, form, or report. This outcome may direct which path a flow follows, or which controls display on a form, or how certain values in a report are formatted.

Rules are built in the Rule Designer. Navigate to a Designer Folder and click the Create Rule button, and select Create Rule.

Example

In the example, create a simple conditional rule that evaluates the account properties Username and Age. If the Username is not null, and Age is greater than 25, the rule will return “true”. Otherwise the rule returns “false”. The example assumes a Designer Folder already exists.

To create the rule, navigate to a Designer Folder and click the Create Rule button and select Create Rule.

 

create_rule

Name the rule and click OK to open it in the Rule Designer.

Next, define the input data type for the rule. The rule will accept two types of data: Username, which is a string, and Age, which is an integer.

First, build the Username input type.

In the Start Rule window, in the Rule Input Data section, click the Add button.

 

 addNewInput

In the resulting pop-up, enter a name for the Username input, then click the Type selector.

user_name

 

 

Select String and click OK.

da_type_sel

 
Back in the Edit object pop-up, click Save to save the input type.
Repeat the process, adding an input type for Age. In the Start Rule window, in the Rule Input Data section, click the Add button.
In the resulting pop-up, we enter a name for the Age input, then click the Type selector.
age
 
 

Select Int32, and click OK.

int 32

 

Back in the Edit object pop-up, click OK to save the input type.

Now that we’ve defined our rule’s input data, it’s time to build the rule.

In the Start Rule window click Add New Rule Step button.

 

 addNewRuleStep
First, build the condition that the user name value is not null. Select User Name [String] and click Next.
 
 pickUserName

Expand the Text Rules category, select Is Not Empty and click Close.

Next, build the rule that the age is greater than 25.

Begin by clicking the Add New Rule Step button.

 

 addNextRuleStep
 
Select Age [Int32] and click Next.
 

Expand the Number Rules category, select Greater Than, and click Next.

Since this comparison requires another value, choose Constant from the Mapping type drop-down list, and enter 25 in the Value field. Click Done.

 ageGreaterThan
The rule is complete. Click on Save Rule. To test the rule, click on Debug Rule.

Note that in Decisions version 3.5 and above, you’ll need to click on Test Flow to access the Debugger.

3.5 Test Flow Shot

Provide a test name, and expected result.

 
The rule needs data to validate. Therefore, enter an appropriate age and user name in the Flow Input Data pop-up and click Run Without Save.
debugRule
 
 
Click on the Play button that appears. The rule runs, and the results display. We can view them graphically on the Graph View tab.
 
 debugResult

Additional Resources