Overview
This node executes a Decision Model and Notation (DMN) decision table based on user-defined rules and parameters. It evaluates input data against the DMN rules using FEEL expressions and produces output according to the specified hit policy and output format.
Common scenarios where this node is beneficial include:
- Automating business decisions that can be expressed as rule tables, such as loan approvals, insurance claim assessments, or pricing calculations.
- Integrating complex decision logic into workflows without custom coding.
- Evaluating multiple input parameters to derive one or more outputs based on predefined decision rules.
For example, you could define input parameters like "age" and "income," set up rules for eligibility, and get outputs like "loan approval status" or "interest rate" automatically evaluated for each incoming data item.
Properties
Name | Meaning |
---|---|
Input Parameters | Define the input parameters used in the DMN table. Each parameter has a name (matching context data key) and a type (String, Number, Boolean). These represent the inputs the decision table will evaluate. |
Output Parameters | Define the output parameters generated by the DMN table. Each has a name (key in the result object) and a type (String, Number, Boolean). These represent the expected outputs from the decision evaluation. |
Hit Policy | The hit policy for the decision table, determining how multiple matching rules are handled. Options: UNIQUE, FIRST, RULE ORDER, COLLECT. |
Output Format | How the output results are formatted: - Row with All Hits (Always Lists): all values for an output name are lists. - Row with All Hits (Single Items and Lists): single values if only one hit, otherwise lists. - Row for Each Hit: creates a separate workflow item for each hit. - JSON with Output: returns the raw result array under a result field. |
Output
The node outputs JSON objects containing the original input data merged with the evaluated output parameters according to the selected output format:
- Row with All Hits (Always Lists): Each output parameter contains a list of all matched values.
- Row with All Hits (Single Items and Lists): Outputs single values if only one match; otherwise, lists.
- Row for Each Hit: Produces one output item per matched rule, each containing the corresponding output parameters.
- JSON with Output: Returns the raw array of all matched results under a
result
key alongside the original input data.
No binary data output is produced by this node.
Dependencies
- Uses the external library
@hbtgmbh/dmn-eval-js
for parsing and evaluating DMN XML. - Requires the
n8n-workflow
package for error handling and logging. - No external API keys or services are required.
- The node expects two inputs:
- Input 0: Rules grid defining the DMN rules.
- Input 1: Data items to evaluate against the DMN rules.
Troubleshooting
Error: "Input 1 (Rules Grid) must contain at least one item with a rule object."
This means the first input (rules) is empty or invalid. Ensure you provide at least one rule item.Error: "At least one Input Parameter must be defined."
You must define at least one input parameter matching the keys in your data context.Error: "At least one Output Parameter must be defined."
You must specify at least one output parameter to receive results.Error: "Failed to construct DMN XML"
Indicates an issue building the DMN XML from the provided rules and parameters. Check the rules and parameter definitions for correctness.Error: "Failed to parse generated DMN XML"
The constructed DMN XML is invalid or empty. Review the rules and parameters for errors.Error: "Error evaluating DMN for item X"
Evaluation failed for a specific data item. Check the input data for missing or mismatched keys and types.Invalid output format selected
The chosen output format is not recognized. Select one of the supported formats.
Links and References
- DMN Specification – Official standard for Decision Model and Notation.
- FEEL Language Reference – For understanding expressions used in DMN.
- @hbtgmbh/dmn-eval-js GitHub – Library used for DMN evaluation.