第6章 Guided rules
Guided rules are business rules that you create in a UI-based guided rules designer in Business Central that leads you through the rule-creation process. The guided rules designer provides fields and options for acceptable input based on the data objects for the rule being defined. The guided rules that you define are compiled into Drools Rule Language (DRL) rules as with all other rule assets.
All data objects related to a guided rule must be in the same project package as the guided rule. Assets in the same package are imported by default. After you create the necessary data objects and the guided rule, you can use the Data Objects tab of the guided rules designer to verify that all required data objects are listed or to import other existing data objects by adding a New item.
6.1. Defining Business Rules リンクのコピーリンクがクリップボードにコピーされました!
Define business rules in Red Hat Process Automation Manager using the Guided Rule wizard.
Related information
For more information about Guided business rules, see Designing a decision service using guided rules.
6.1.1. Creating the Validate Down Payment guided rule リンクのコピーリンクがクリップボードにコピーされました!
Procedure
-
Log in to Business Central and click Menu
Design Projects, then Mortgage Process. Click Add Asset
Guided Rule, then enter: -
Guided Rule:
Validate Down Payment -
Package:
com.myspace.mortgage_app
-
Guided Rule:
- Click Ok to open the Guided Rule Editor.
6.1.2. Defining the Validate Down Payment guided rule conditions リンクのコピーリンクがクリップボードにコピーされました!
The conditions that you specify in this section are used to determine whether of not the down payment meets the specified requirements.
Procedure
-
Click
next to the WHEN label to open the Add a condition to the rule window. Then, select Application… and click Ok.
- Click the There is an Application label and select Any of (Or) from Multiple field constraints.
- Click the There is an Application [app] with: any of the following: label , then select downpayment from Add a restriction on a field.
Click --- please choose ---, then select equal to.
Click
, select Literal value, and enter 0.- Click the There is an Application [app] with: any of the following: label, then from the Add a restriction on a field select downpayment.
- Click --- please choose ---, then select greater than or equal to.
-
Click
, then click Expression editor.
- From the Choose… menu, select app.
- From the Choose… menu, select downpayment.
6.1.3. Defining the error conditions リンクのコピーリンクがクリップボードにコピーされました!
You must define the conditions and results of the data that is received and processed. In this section, you will define the following two conditions:
- ValidationErrorDO
- retractValidationErr
6.1.3.1. Defining the ValidationErrorDO リンクのコピーリンクがクリップボードにコピーされました!
Specify the error message that will be presented to the loan applicant.
Procedure
-
Click
next to the THEN label. Select Insert fact ValidationErrorDO, and click Ok.
- Click the Insert ValidationErrorDO label and select error from the Add field pull-down menu.
-
Click
, then click Literal value.
In the error field, enter:
Down payment cannot be 0, greater than, or equal to the property sale price..-
Click
next to the THEN label. Select Add free form DRL and click Ok.
Enter the following in the Add free form DRL… text box:
System.out.println("Executed Rule: " + drools.getRule().getName() );System.out.println("Executed Rule: " + drools.getRule().getName() );Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Click (show options…).
-
Click
next to the (options) label to open the Add an option to the rule window.
Select ruleflow-group from the Attribute drop-down menu and enter validation in the ruleflow-group field.
6.1.3.2. Defining the retractValidationErr リンクのコピーリンクがクリップボードにコピーされました!
Define the error trigger details.
Procedure
-
Click
next to the WHEN label to open the Add a condition to the rule window. Then, select ValidationErrorDO and click Ok.
-
Click There is a ValidationErrorDO to open the Modify constraints for ValidationErrorDO window, enter
vdoin the variable name field, and click Set. -
Click
next to the THEN label. Select Delete vdo, and click Ok.
- Click (show options).
Enter
errorin the ruleflow-group field.- Click Save, then click Save to confirm your changes.