Overview
This node executes business rules defined in the Zen Decision Model (JDM) format using the Zen Engine (GoRules). It takes a set of rules and input data, evaluates the input against the rules, and outputs the evaluation results. This is useful for automating decision-making processes such as eligibility checks, pricing calculations, or compliance validations where complex rule logic needs to be applied dynamically.
Practical examples include:
- Evaluating loan application data against credit scoring rules.
- Applying discount rules to shopping cart data.
- Validating insurance claims based on predefined criteria.
Properties
| Name | Meaning |
|---|---|
| Rules | Definition of rules in JSON format following the JDM specification. |
| Input Data | Input data in JSON format that will be evaluated against the provided rules. |
Output
The output is an array containing one object per input item. Each object has a json field with the evaluation result of the rules against the input data. The structure of the json output corresponds to the result property returned by the Zen Engine's evaluation method, which typically includes the outcome of the decision logic.
If an error occurs during evaluation and the node is configured to continue on failure, the output for that item will contain a json field with an error property describing the issue.
Dependencies
- Requires the Zen Engine library (
@gorules/zen-engine) to parse and evaluate the rules. - No external API keys or credentials are needed.
- Runs entirely within n8n, so no additional environment variables are required.
Troubleshooting
- Common issues:
- Invalid JSON syntax in the "Rules" or "Input Data" properties can cause parsing errors.
- Malformed or incompatible rule definitions that do not conform to the expected JDM format may lead to evaluation failures.
- Error messages:
- JSON parsing errors will indicate invalid JSON input; ensure the JSON is well-formed.
- Evaluation errors from the Zen Engine will be reported with their message; check the rules and input data for correctness.
- To handle errors gracefully, enable the "Continue On Fail" option in the node settings to prevent the workflow from stopping on individual item errors.
Links and References
- Zen Engine (GoRules) GitHub Repository – For detailed documentation on rule definitions and engine capabilities.
- JSON Decision Model (JDM) Specification – For understanding the standard format used for defining rules.