Business Rule Task

A Business Rule task is used to synchronously execute one or more rules.

Using Camunda DMN Engine

You can use the Camunda DMN engine integration to evaluate a DMN decision table. You have to specify the decision key to evaluate as the camunda:decisionRef attribute. Additionally the camunda:decisionRefBinding specifies which version of the decision should be evaluated. Valid values are deployment which evaluates the decision version which was deployed with the process version, latest which will always evaluate the latest decision version and version which allows you to specify a specific version to execute with the camunda:decisionRefVersion attribute.

<businessRuleTask id="businessRuleTask"
    camunda:decisionRefVersion="12" />

The camunda:decisionRefBinding attribute defaults to latest.

<businessRuleTask id="businessRuleTask"
    camunda:decisionRef="myDecision" />

The attributes camunda:decisionRef and camunda:decisionRefVersion can both be specified as an expression which will be evaluated on execution of the task.

<businessRuleTask id="businessRuleTask"
    camunda:decisionRefVersion="${decisionVersion}" />

The output of the decision, also called decision result, is not saved as process variable automatically. It has to pass into a process variable by using a predefined or a custom mapping of the decision result.

In case of a predefined mapping, the camunda:mapDecisionResult attribute references the mapper to use. The result of the mapping is saved in the variable which is specified by the camunda:resultVariable attribute. If no predefined mapper is set then the resultList mapper is used by default.

<businessRuleTask id="businessRuleTask"
    camunda:resultVariable="result" />

See the User Guide for details about the mapping.

Name of the Result Variable

The result variable should not have the name decisionResult since the decision result itself is saved in a variable with this name. Otherwise an exception is thrown while saving the result variable.

Using a Custom Rule Engine

You can integrate with other Rule Engines. To do so, you have to plug in your implementation of the rule task the same way as in a Service Task.

<businessRuleTask id="businessRuleTask"
    camunda:delegateExpression="${MyRuleServiceDelegate}" />

Using Delegate Code

Alternatively a Business Rule Task can be implemented using Java Delegation just as a Service Task. For more information on this please see the Service Tasks documentation.

Camunda Extensions

Attributes camunda:asyncBefore, camunda:asyncAfter, camunda:class, camunda:decisionRef, camunda:decisionRefBinding, camunda:decisionRefVersion, camunda:delegateExpression, camunda:exclusive, camunda:expression, camunda:jobPriority, camunda:mapDecisionResult, camunda:resultVariable, camunda:type
Extension Elements camunda:failedJobRetryTimeCycle, camunda:field, camunda:connector, camunda:inputOutput
Constraints One of the attributes camunda:class, camunda:delegateExpression, camunda:decisionRef, camunda:type or camunda:expression is mandatory
The attribute camunda:resultVariable can only be used in combination with the camunda:decisionRef or camunda:expression attribute
The camunda:exclusive attribute is only evaluated if the attribute camunda:asyncBefore or camunda:asyncAfter is set to true

Additional Resources

On this Page: