51.2. Adding THEN actions in guided rules
The THEN part of the rule contains the actions to be performed when the WHEN condition of the rule has been met. For example, when a loan applicant is under 21 years old, the THEN action might set approved to false, declining the loan because the applicant is under age. You can set simple or complex actions to determine how and when your rules are applied.
Prerequisites
- All data objects required for your rules have been created or imported and are listed in the Data Objects tab of the guided rules designer.
Procedure
In the guided rules designer, click the plus icon (
) on the right side of the THENsection.The Add a new action window with the available action elements opens.
図51.5 Add a new action to the rule
The list includes insertion and modification options based on the data objects in the Data Objects tab of the guided rules designer, and on any DSL objects defined for the package (if you selected Show declared DSL sentences when you created this guided rule):
-
Change field values of: Use this to set the value of fields on a fact (such as
LoanApplication) without notifying the decision engine of the change. - Delete: Use this to delete a fact.
- Modify: Use this to specify fields to be modified for a fact and to notify the decision engine of the change.
- Insert fact: Use this to insert a fact and define resulting fields and values for the fact.
- Logically Insert fact: Use this to insert a fact logically into the decision engine and define resulting fields and values for the fact. The decision engine is responsible for logical decisions on insertions and retractions of facts. After regular or stated insertions, facts have to be retracted explicitly. After logical insertions, facts are automatically retracted when the conditions that originally asserted the facts are no longer true.
- Add free form DRL: Use this to insert a free-form DRL field where you can define condition elements freely, without the guided rules designer.
- Call method on: Use this to invoke a method from another fact.
-
Change field values of: Use this to set the value of fields on a fact (such as
- Choose an action element (for example, Modify) and click Ok.
Click the action element in the guided rules designer and use the Add a field window to select a field.
図51.6 Add a field
After you select a field, the window closes automatically.
-
Click the edit icon (
) to define the field value. The field value can be a literal value or a formula.
- After you define all action components of the rule, click Validate in the upper-right toolbar of the guided rules designer to validate the guided rule actions. If the rule validation fails, address any problems described in the error message, review all components in the rule, and try again to validate the rule until the rule passes.
- Click Save in the guided rules designer to save your work.