Javascript JSON expression example in DMN

Hi all!

I’m generating DMN using GitHub - camunda/camunda-dmn-model: DMN model API written in Java. java library.
I was looking around how could i simply use existing Camunda process-flow json data without any additional transformation in DMN.
First i tried to use juel script but after several attemps just tried javascript once and it works!
So i would like to share my experience to other developers who might need it too.

  1. Let say json is defined in my unit test as variable input data:
    String json = “{"roleaaselection":"validated"}”;
    VariableMap variables = Variables.putValue(“json”, json);

  2. Input variable inputEntry is defined in DMN generation shortly:

  3. and Rule input itself is FEEL value: “"validated"”

Generated DMN looks itself completely:
example.dmn (4.3 KB)

Are you saying that you’re dynamically creating DMN tables? If so, what rules drive their creation and how to determine what the input and output values and types would be?

Yes. Because we have developed our own analyse tool, both BPMN and DMN are generated dynamically after clicking publish button.
Analyse tool - it is like a wrapper for modeler. User can define only very strict rules using simple selection and choices.