Rule/Flow SetsLast Updated: 07/15/2016 Introduced in Verision: 2.0
Flow and Rule Sets are a common set of rules and flows that can be parameterized or customized based on context without the need to copy or rewrite them. The Rule Set allows you to define a number of rules or flows that can work together. These define the process that you would like to follow that will be known as the base set.
Once a Rule Set is defined in the base set, a subset can be created. This allows a change in the process to be added to a group of Flows and Rules without the need to recreate each item. The subset has the ability to alter input data, which rules are applied, and which processing elements should remain. The process will stay the same, but the context of each subset can be modified for the situation.
An example of this would be through an Auto Insurance processing company. By defining a base flow set, you can set the process of how you would like to approve insurance applications and apply rules to the data. However, with a large company, there may be a difference in how you would like to approve the application. For example, the application approval requirements may differ depending on owner’s car specifications. Although the main flow approving process is the same, you can specify the subset and change some of the context.
Here is an example of how to create a flow set:
Note: In order to use Rule Sets, you must have the Flow Sets Module Installed. This Module is found in System > Administration > Modules Folder in Portal. To install it, we click it and use Install Module action.
Note: to install Module in Decisions 3.5 or newer, please read the following document.
After Flow Sets Module is installed, we will create Application Structure to use in our Rule Set. In the Designer Folder we create Flow Structure from Datatypes/Database > User Defined Types on Folder Actions Panel.
In the resulting window we Name our structure and click Add to add data members to our structure.
When all desirable Data Members added to our structure, we can click Ok to save the structure.
Next, in the Designer Folder from All Folder Actions we select Create Rule/Flow Set.
In the resulting pop-up window we Name our Rule Set and click Ok.
A Sub Folder for our Rule Set is being created by the System in our Designer Folder. We navigate to this Folder.
In the Rule Set Folder we click Edit Flow/Rule Set on the Folder Actions Panel.
In the Edit Flow Template Data window we make the following configurations…
Logical – apply logical check to data. Best used for validations and data check.
Data Return – best use for data manipulations.
Scoring – used for statistical purposes when need to do manipulations on the rule results count.
Run All – run all Rules/Flows in the Set
Stop On First True – terminate Set execution on first Rule evaluating as True
Stop On First False – terminate Set execution on first Rule evaluating as False
Template w/ Instances – used when we want to create a base Set of Rules and then create specific sub-sets of Rules.
Instance – used when we want to create just a Set of Rules without specific sub-sets.
In the Inputs Setup we need to define Rule Set Inputs. These Inputs will be passed into each Rule/Flow in our Set. We click Add New link to add an Input.
In the Add Inputs window we Name our Input and pick a Type of the PolicyApplication Structure that we have created previously in this tutorial. Click Ok to save and close Add Inputs window.
When our Rule Set is configured we can click Ok to save it.
Next, we can start creating Rules for our Set. From the Folder Action Panel we click Add Rule > Evaluation. There are two types of Rules that can be created in Rule Set: Evaluation and Action. If we need to validate or check data (apply logic) we use Evaluation type; If we need to manipulate or change data – we use Action type.
In the resulting window we name our Rule and click Create.
Mention, that our Rule has Application input by default. We can build our Rule Phrase using Application properties. In this case we build a Rule to check if applicant is currently insured.
Our firs Rule looks as following…
Next, we add another Evaluation Rule to check income range. For this Rule we add additional Min and Max inputs.
The logic for this Rule is next…
Then, we add another Rule to validate if applicant is older than our requirements. For this Rule we add additional input of type Timespan.
We use this additional Rule input to Configure Offset for Compute Date.
And this Rule design completed…
Next, we create Denial Rule that looks as following…
Then, we add another Evaluation Rule to validate if applicant is younger than our requirement. We set Rule inputs in similar manner as we did for Older Than Rule.
Again, we use additional Rule input for Computing Date.
Our last Rule designed as following…
Because we configured our Rule Set to be a Template w/ Instances, we can add Instances of this template. In the Instance we can create additional (specific) Rules. We click Create Instance button on the Folder Actions Panel in Rule Set Folder.
In the resulting pop-up window we Name our Instance and click Ok. System creates an Instance Sub Folder.
For this example we created two Instances: Policy A and Policy B. Navigate to the Policy B instance.
For this instance all base Rules will be ran automatically. Mention, that we have Application input by default. We create an Evaluation Rule for this Instance.
This Instance will be specific because this Rule will define additional requirements and data validation. We design a Rule that checks vehicle horse power.
Our Rule Set is completed now. We can close it and navigate to the Designer Folder where we will build a Flow to test this Rule Set.
In the Designer Folder we click Create Flow from the Folder Actions Panel.
Then, we Name the Flow and click Create to proceed to the Flow Designer.
In the Flow Designer we add Run Rule/Flow Set step from Flows, Rules, Forms and Reports > Rules category and connect its outcome to the End step in our Flow.
Our Rule Set will require an Application to Evaluate. We are going to create an Application as an input to the Flow. Select Start step on the workspace and click Add New link in the Inputs section.
As described, we Name our Input Data and define its type of PolicyApplication.
Next, we select Run Rule/Flow Set step on the workspace. Using TemplateId picker we select our Template Rule Set.
For the Application Input to the PolicyRuleSet we use Select Value Mapping type and pick Application that we defined in the Start Step. For the Rule Set Id we are going to provide Constant Id to the Policy B Rule Set Instance.
We can get Policy B Rule Set Id in its Folder in Manage section.
We copy this Id and paste into RuleFlowSetId Value.
This completes our Flow. We click Debug Flow link on the top panel of the Flow Designer to test our Flow.
Note that in Decisions version 3.5 and above, you’ll need to click Unit Test to access this function.
Flow Unit Test window pops up. We Name test unit and click ellipses to create Application Input.
In the resulting window we populate Application fields with data and click Ok.
Then, we Save our Unit Test.
Next, we can Run our Unit Test…
Flow executes in the Debugger with no issues. We can confirm that Run Rule/Flow Set step outputs PolicyRuleSet evaluation results for each Rule in the Set.