Use DMN decision result as input for another DMN

I have a DMN that is working fine and after evaluation, it outputs a dishDecision. I now would like to use this dishDecision value in another DMN.

I tried setting the input like dishDecision["desiredDish"] as the input expression in my second DMN but Camunda is saying it can’t find the variable.

What is the correct way of referring to an already executed DMN Decision output if it is using the default camunda:mapDecisionResult setting (i.e., resultList)

Here’s the DMN in which I want to use another DMN’s Output:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/" xmlns:camunda="http://camunda.org/schema/1.0/dmn" xmlns:dmndi="https://www.omg.org/spec/DMN/20191111/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" id="dinnerDecisions" name="Dinner Decisions" namespace="http://camunda.org/schema/1.0/dmn" exporter="Camunda Modeler" exporterVersion="4.8.1">
  <decision id="dish" name="Dish" camunda:historyTimeToLive="P180D">
    <decisionTable id="decisionTable">
      <input id="season" label="Season" camunda:inputVariable="season">
        <inputExpression id="inputExpression1" typeRef="string">
          <text>season</text>
        </inputExpression>
      </input>
      <input id="guests" label="How many guests" camunda:inputVariable="guests">
        <inputExpression id="LiteralExpression_0h5951a" typeRef="integer">
          <text>guests</text>
        </inputExpression>
      </input>
      <output id="output1" label="drink" name="desiredDrink" typeRef="string" />
      <rule id="row-129502239-1">
        <description></description>
        <inputEntry id="UnaryTests_0e47zyl">
          <text>"Fall"</text>
        </inputEntry>
        <inputEntry id="UnaryTests_1132erh">
          <text>&gt;=8</text>
        </inputEntry>
        <outputEntry id="LiteralExpression_0wv4x30">
          <text>"Gin"</text>
        </outputEntry>
      </rule>
      <rule id="row-129502239-2">
        <inputEntry id="UnaryTests_0iwabd6">
          <text>"Winter"</text>
        </inputEntry>
        <inputEntry id="UnaryTests_10qbns7">
          <text>&lt;= 8</text>
        </inputEntry>
        <outputEntry id="LiteralExpression_0ysj59c">
          <text>"Tonic"</text>
        </outputEntry>
      </rule>
    </decisionTable>
  </decision>
</definitions>

Hey @segura2794! :wave:
Camunda has quite a good example related to your question in their DMN Simulator.

I have attached the model to the post. There you have two decisions, where one depends on another.
Does this solve your question?

simulation.dmn (9.7 KB)

Best,
Thomas

Hi Thomas!

Thank you so much for your reply. This looks like it might work, what happens is that I’m building a BPMN Process that uses DMN in it. You can integrate DMN into BPMN with the use of Business Rule Tasks.

My BPMN Process has a User Task which contains a form that can be filled in by the user and these values will populate into process variables that the DMN table 1 is able to consume. I can see the decision results of both tables.

The problem I’m facing is that my DMN is mapping my decision result into a variable of type List<Map<String, Object>> (which seems to be the default).

So I’m not exactly sure how to access the values within a variable of that shape.

I’m going to try breaking up the DMN simulation you shared into two different DMNs and see if I can put them inside the two different Business Rule Tasks inside my process.

Going to carefully examine the code you shared but wanted to give you more context.

Thank you so much,
Daniel