DMN Output Expression Support for Java Delegate Classes

I am trying to use Groovy as the expression language for OUTPUTS. I suppose I could use JavaScript, but my understanding is that Groovy has broader capabilities.

What I want to do is have a set of inputs match and then essentially execute a statement like the following to set the value of a process variable, rather than having to hard code a value into the output column.

execution.setVariable(‘extra’, ‘<’ + execution.getVariable(‘fromWklstCategoryCode’) + execution.getVariable('toWklstCategoryCode") + ‘>’)

Don’t evaluate this expression literally, as I don’t really know Groovy. If you know of an expression that would perform this, then please share.

I have included the Groovy library in my project and have modified the global definition tag of the DMN XML code to use Groovy as the expression engine. After saving and deployment, Camunda Modeler as well as the Camunda Cockpit recognize the above as an expression (versus simply treating it as text).

However, the evaluation results in no output or even an error. I’m wondering if by changing the expression language, I also changed the how the inputs are evaluated and thus I’m not actually matching any of the simple unary string values.

Hi Michael,

if the output should be a concatenation of two string variables then you can write
'<' + fromWklstCategoryCode + toWklstCategoryCode + '>'.

This works because you can access process variables simply by name. See the User Guide for details.

Does this help you?

Best regards,

1 Like


Just to be sure, because that answer would be awesome, you’re saying I DO NOT need to use the Java delegate class to access a process variable within the OUTPUT of a DMN table when using Groovy as the expression language?

If that’s true, I wish I were closer to you, because I at least owe you a beer!


Hi Michael,

I’m not 100% sure if I understand your use case. Assuming that

  • the process with a business rule task
  • the process instance has two variables: fromWklstCategoryCode and toWklstCategoryCode
  • the decision table has some inputs and an output with name categoryCode

Then the decision table can have an output entry which uses process variables and concatenate them (see the expression below).

When the decision table is evaluated then the decision result contains an output with name categoryCode and the concatenated string. You can map this result into a process variable by configuring the business rule task.

Does this help you?
If not, please provide an example :slight_smile:

Best regards,

We have a need to vary what a particular output is set to based upon particular inputs. The output variable(s) value is the result of the concatenation of certain static strings as well as existing process variables.

The Groovy as the expression language is based purely upon the perception that it offers the broadest range of functionality and we want to encourage people to use one expression language rather six.

Thank you, Phillip. You have been very helpful!