i
Rules Examples
This example shows how to create a rule, show parameters, and execute it.
Rules Modeling for Examples
Step 1
Model a “VATcalculation” rule with the suggested values.
Descriptive Name |
VATcalculation |
Adapter |
Standard Rule |
JAVA code |
VATvalue = (VATrate * Entryamount) / 100 ; Totalamount = Inputamount + VATvalue ; |
Input Parameters |
VATrate Inputamount |
Output Parameters |
VATvalue Totalamount |
In the properties panel, on the "General" tab, select the Deploy Rest API property. This option allows the rule to be consumed as Rest API externally.
Step 2
In the "Permissions" option, add the security function "Execute rule via Rest + RuleName" to a new permission, for example "ApiRestPermission".
Step 3
Assign to the previously created user the generated permission.
Rules Collection
Examples are implemented from Postman to execute each of the operations described in the following table. Previously, you must import the Rules collection
Operation |
Description |
---|---|
Returns the input and output parameters of the rule. |
|
Executes the rule "VATcalculation" sending the fields "Inputamount" and "VATrate". Returns "VATvalue" and "Totalamount".
|