You create an action to define reusable logic that accepts parameters and performs side
effects without returning a value.
Procedure
- Click the Add button
next to
Data model and select Action from the drop-down
list.
- Replace the default action name with a descriptive name. It is recommended to use a
singular form for the function name.
- Optional: Define a documentation property using the
Documentation text field. This documentation is visible in the prediction
menu in the rule editor.
- Define the input parameters for the action:
- Click Add + in the Input parameters
section.
- Enter a suitable name for the parameter. It is recommended to use a singular form for
the parameter name.
- Associate the parameter with a data type that you select from the
Type drop-down list.
- Optional: Identify the parameter as a list by checking
List. When a parameter is identified as a list, it can have multiple
values.
- Optional: Edit the default verbalization of the parameter.
- Repeat for other parameters.
- Optional: Click the Verbalization placeholder to edit
the default verbalization of the action and edit it directly in the pop-up window that
opens.
The default verbalization is based on the name of the action. You can revert to
the default verbalization by clicking Reset.
- Define the body of the action:
- Select the type of action that you want to define:
- BFL expression for a simple expression that returns a value.
- BFL code block for complex logic that requires multiple statements.
- In the editor, write the action logic by using the Business
Function Language (BFL).
Example
- Example: code block to reject a loan with a message
-
The following example demonstrates a simple action that rejects a loan application and sets a
custom rejection message:
loan does not get approved ;
set the message of the loan to message ;
This 'reject' action is constructed with two input parameters: a loan object and
a message string.