Designing business rules

DMN

Supported Types

Camunda supports the following types in DMN:

  • Number
  • String
  • Boolean
  • Time
  • Date
  • Date-Time
  • Days-Time-Duration
  • Years-Months-Duration

Decision Table

Input Data

A decision table can have one or multiple inputs. The input column is described by the header, expression, and input type.

empty

The input expression consists of the following fields:

  • input expression header;
  • expression - typically a variable;
  • expression language - the scripting language;
  • input variable - if the input expression is decisional (e.g., currentSeason != "Fall"), the evaluation result of the expression will be stored in this field;
  • type - the type of the input expression.

Output Data

Described in the same way as the input expression. The output expression column has the same fields.

If a decision table has only one output expression, it is recommended to use the identifier of that table as the output name when referenced from another decision table. If a decision table has more than one output expression, then expressions are grouped by the decision identifier and can be accessed by their output names (e.g., decisionId.outputName).

⚠️

The output name cannot contain any special characters or symbols (e.g., spaces, hyphens, etc.). The output name can be any alphanumeric string, including the '_' symbol. For word combinations, it is recommended to use camelCase or snake_case format. The kebab-case format is not allowed as it contains the '-' operator. If the output name contains a special character, access to the output is not possible in dependent decisions or the calling BPMN process.

Hit Policy

The policy defines how many decision table rules can be satisfied and which of the satisfied rules are included in the decision result.

The Unique, Any, and First policies will always return no more than one satisfied rule. Rule Order and Collect hit policies can return multiple satisfied rules.

The following hit policies are supported:

  • Unique - 0-1 rule can be satisfied. If more than 1 rule is satisfied, a policy violation occurs;
  • Any - multiple rules can be satisfied. However, all satisfied rules must produce the same result. If multiple rules are satisfied, generating different output violates the hit policy;
  • First - multiple rules can be satisfied. The decision table result contains only the output of the first satisfied rule;
  • Rule Order - multiple rules can be satisfied. The decision table result contains the output of all satisfied rules in the order they appear in the decision table;
  • Collect - multiple rules can be satisfied. The decision table result contains the output of all satisfied rules in arbitrary order as a list. An aggregator can be specified for the collection. If an aggregator is specified, the result will contain only one output entry, and the aggregator function will be applied to all satisfied rules;
  • Priority;
  • Output order.

Script Expression

This solution represents decision logic that can be expressed as a script expression. Several languages are supported:

empty