I am trying to find out how to evaluate a list defined in a process variable (Added through the modeler) which then gets iterated overs and resolves to the evaluated rules output.
I define the bankList in the modeler as an output variable as on the Capture Task as such
The Lookup Contacts for Branch task is a DMN task set as sequential multi instance configured thusly:
However I cannot find a way to set the collection variables for the output.
I am expecting a list of maps as the return.
I refer this this documentation although I know it is Camunda Cloud.
Is there some way to do this, iterate over a list, evaluate and store the results in another list as a process variable?
Hi @SlappyAUS,
a long time ago I build an example for this: ingo-camunda-examples/process-applications/decision-resultlist at master · ingorichtsmeier/ingo-camunda-examples · GitHub
The concept is still valid these days: Handle the result variable where you collect the decision results outside of the business rule task.
Hope this helps, Ingo
Ingo,
Thanks for the resopnse. I think I have it 90% there but there still seems to be an error when evaluating a rule on a match:
org.camunda.bpm.dmn.feel.impl.FeelException: FEEL/SCALA-01008 Error while evaluating expression: failed to evaluate expression '"Bank Windhoek"': expect List but found 'ValString(Bank Windhoek)'
I have included a minimum reproducible example
Rules
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/" xmlns:dmndi="https://www.omg.org/spec/DMN/20191111/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:biodi="http://bpmn.io/schema/dmn/biodi/2.0" xmlns:camunda="http://camunda.org/schema/1.0/dmn" id="resolveBankContacts" name="Resolve Bank Contacts" namespace="http://camunda.org/schema/1.0/dmn" exporter="Camunda Modeler" exporterVersion="4.11.0">
<decision id="bankContacts" name="bankContacts">
<decisionTable id="DecisionTable_0lt0omy">
<input id="Input_1" label="dealershipBranchName" biodi:width="237" camunda:inputVariable="dealershipBranchName">
<inputExpression id="InputExpression_1" typeRef="string">
<text></text>
</inputExpression>
<inputValues id="UnaryTests_1vw9glj">
<text>"Dealer Toyota Windhoek","Dealer Toyota Okahandja","Dealer Toyota Walvisbay","Dealer Toyota Otjiwarongo","Dealer Ford Oshakati","Dealer Toyota Ongwediva"</text>
</inputValues>
</input>
<input id="InputClause_1e1v5sm" label="bankName" camunda:inputVariable="bankList">
<inputExpression id="LiteralExpression_13magf2" typeRef="string">
<text></text>
</inputExpression>
<inputValues id="UnaryTests_0svsbqw">
<text>"Bank Windhoek","Nedbank","Wesbank"</text>
</inputValues>
</input>
<output id="Output_1" label="contactEmail" name="contactEmail" typeRef="string" biodi:width="338" />
<output id="OutputClause_0o8yizn" label="contactName" name="contactName" typeRef="string" biodi:width="413" />
<output id="OutputClause_1px3x02" name="bankName" typeRef="string" />
<rule id="DecisionRule_1wo4nqc">
<inputEntry id="UnaryTests_1t8tobj">
<text>"Dealer Toyota Windhoek"</text>
</inputEntry>
<inputEntry id="UnaryTests_0hvcqpp">
<text>"Bank Windhoek"</text>
</inputEntry>
<outputEntry id="LiteralExpression_0uwqk3l">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_14ion83">
<text>"Samantha (Sales Manager)"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1gweo8v">
<text>"Bank Windhoek"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_0i40u6s">
<inputEntry id="UnaryTests_0tlwman">
<text>"Dealer Toyota Okahandja"</text>
</inputEntry>
<inputEntry id="UnaryTests_0dbt0le">
<text>"Bank Windhoek"</text>
</inputEntry>
<outputEntry id="LiteralExpression_0hh46hb">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0i0may5">
<text>"Marinda (sales consultant)"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0pgcscg">
<text>"Bank Windhoek"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_1etlxo7">
<inputEntry id="UnaryTests_1pz6f9f">
<text>"Dealer Toyota Walvisbay"</text>
</inputEntry>
<inputEntry id="UnaryTests_13iqe71">
<text>"Bank Windhoek"</text>
</inputEntry>
<outputEntry id="LiteralExpression_0m6a27d">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0wyujx4">
<text>"Julian"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1xelgty">
<text>"Bank Windhoek"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_0lzrs2d">
<inputEntry id="UnaryTests_1j13oge">
<text>"Dealer Toyota Otjiwarongo"</text>
</inputEntry>
<inputEntry id="UnaryTests_0uma507">
<text>"Bank Windhoek"</text>
</inputEntry>
<outputEntry id="LiteralExpression_0ya14ze">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1m96lzs">
<text>"Mark"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0iu7f8g">
<text>"Bank Windhoek"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_0lcn222">
<inputEntry id="UnaryTests_16gdeuv">
<text>"Dealer Ford Oshakati"</text>
</inputEntry>
<inputEntry id="UnaryTests_0q5jurw">
<text>"Bank Windhoek"</text>
</inputEntry>
<outputEntry id="LiteralExpression_0fja66y">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1qiqqap">
<text>"Hilya"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1wesq1j">
<text>"Bank Windhoek"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_13x1c71">
<inputEntry id="UnaryTests_15ajmle">
<text>"Dealer Toyota Ongwediva"</text>
</inputEntry>
<inputEntry id="UnaryTests_1igh3bv">
<text>"Bank Windhoek"</text>
</inputEntry>
<outputEntry id="LiteralExpression_0wiky1h">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0qf1kat">
<text>"Hilya"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0dqop7q">
<text>"Bank Windhoek"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_1eouar8">
<inputEntry id="UnaryTests_1u9i11r">
<text>"Dealer Toyota Windhoek"</text>
</inputEntry>
<inputEntry id="UnaryTests_04qhb9q">
<text>"Nedbank"</text>
</inputEntry>
<outputEntry id="LiteralExpression_1sj30za">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1cdt8rn">
<text>"Enrico"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1q2o5t7">
<text>"Nedbank"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_1crrkj5">
<inputEntry id="UnaryTests_1k8ugfs">
<text>"Dealer Toyota Okahandja"</text>
</inputEntry>
<inputEntry id="UnaryTests_07sferr">
<text>"Nedbank"</text>
</inputEntry>
<outputEntry id="LiteralExpression_0s4hqji">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1j94uxh">
<text>"Enrico enade"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1w02qpd">
<text>"Nedbank"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_0k7frwn">
<inputEntry id="UnaryTests_0f0t1e6">
<text>"Dealer Toyota Walvisbay"</text>
</inputEntry>
<inputEntry id="UnaryTests_1mwujk5">
<text>"Nedbank"</text>
</inputEntry>
<outputEntry id="LiteralExpression_0p72u8a">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0wt4to2">
<text>"Randy"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1ye378h">
<text>"Nedbank"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_1snp5pd">
<inputEntry id="UnaryTests_0yoagyc">
<text>"Dealer Toyota Otjiwarongo"</text>
</inputEntry>
<inputEntry id="UnaryTests_14vmq6e">
<text>"Nedbank"</text>
</inputEntry>
<outputEntry id="LiteralExpression_1r62x2r">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0anp9yt">
<text>"Alexander"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1naw41i">
<text>"Nedbank"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_15du11v">
<inputEntry id="UnaryTests_1eyl4q6">
<text>"Dealer Ford Oshakati"</text>
</inputEntry>
<inputEntry id="UnaryTests_18rwui8">
<text>"Nedbank"</text>
</inputEntry>
<outputEntry id="LiteralExpression_0g75kxz">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0opg60l">
<text>"Alexander"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0wn85nz">
<text>"Nedbank"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_1ruuzho">
<inputEntry id="UnaryTests_0e7gar9">
<text>"Dealer Toyota Ongwediva"</text>
</inputEntry>
<inputEntry id="UnaryTests_0ykg78u">
<text>"Nedbank"</text>
</inputEntry>
<outputEntry id="LiteralExpression_1etg70p">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_03yap2u">
<text>"Alexander"</text>
</outputEntry>
<outputEntry id="LiteralExpression_15zo1fz">
<text>"Nedbank"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_13xdwag">
<inputEntry id="UnaryTests_1d5qfbt">
<text>"Dealer Toyota Windhoek"</text>
</inputEntry>
<inputEntry id="UnaryTests_0ie9t85">
<text>"Wesbank"</text>
</inputEntry>
<outputEntry id="LiteralExpression_10h0g0e">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_16x9aov">
<text>"Deidre"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0gz79og">
<text>"Wesbank"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_0yj7jvx">
<inputEntry id="UnaryTests_0a2xxbp">
<text>"Dealer Toyota Okahandja"</text>
</inputEntry>
<inputEntry id="UnaryTests_0qtpo93">
<text>"Wesbank"</text>
</inputEntry>
<outputEntry id="LiteralExpression_0s64td9">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_11dwtwe">
<text>"Deidre"</text>
</outputEntry>
<outputEntry id="LiteralExpression_13raurn">
<text>"Wesbank"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_02grgox">
<inputEntry id="UnaryTests_0wrg385">
<text>"Dealer Toyota Walvisbay"</text>
</inputEntry>
<inputEntry id="UnaryTests_1mqhh26">
<text>"Wesbank"</text>
</inputEntry>
<outputEntry id="LiteralExpression_16pohpe">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1ex5vlq">
<text>"Danielle"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0p2uk1z">
<text>"Wesbank"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_1vgo9rk">
<inputEntry id="UnaryTests_1hb3ksr">
<text>"Dealer Toyota Otjiwarongo"</text>
</inputEntry>
<inputEntry id="UnaryTests_0sydy4k">
<text>"Wesbank"</text>
</inputEntry>
<outputEntry id="LiteralExpression_00qbv6o">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1lmg9ct">
<text>"Ruzcha"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0fmykse">
<text>"Wesbank"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_0wwizsa">
<inputEntry id="UnaryTests_1ni8sha">
<text>"Dealer Ford Oshakati"</text>
</inputEntry>
<inputEntry id="UnaryTests_1l3efps">
<text>"Wesbank"</text>
</inputEntry>
<outputEntry id="LiteralExpression_1qdusm1">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1blm3ji">
<text>"Bismarck"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0zlm1sd">
<text>"Wesbank"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_1ctdvjw">
<inputEntry id="UnaryTests_0630eud">
<text>"Dealer Toyota Ongwediva"</text>
</inputEntry>
<inputEntry id="UnaryTests_1ymwb6z">
<text>"Wesbank"</text>
</inputEntry>
<outputEntry id="LiteralExpression_054ez5w">
<text>"email@address.com"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0r4dwlo">
<text>"Bismarck"</text>
</outputEntry>
<outputEntry id="LiteralExpression_04j8bds">
<text>"Wesbank"</text>
</outputEntry>
</rule>
</decisionTable>
</decision>
<dmndi:DMNDI>
<dmndi:DMNDiagram>
<dmndi:DMNShape dmnElementRef="bankContacts">
<dc:Bounds height="80" width="180" x="160" y="100" />
</dmndi:DMNShape>
</dmndi:DMNDiagram>
</dmndi:DMNDI>
</definitions>
Process
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1jwds9j" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.11.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
<bpmn:process id="TestProcess" name="Test Process" isExecutable="true">
<bpmn:startEvent id="Event_1ultm1a" name="Try to resolve bank contact details">
<bpmn:outgoing>Flow_1y7tces</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:endEvent id="Event_1hmtjlj" name="Contact Information Resolved">
<bpmn:incoming>Flow_0vocsrk</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_1y7tces" sourceRef="Event_1ultm1a" targetRef="Activity_150a9fv" />
<bpmn:userTask id="Activity_150a9fv" name="Capture">
<bpmn:extensionElements>
<camunda:formData>
<camunda:formField id="indongoBranchName" label="Dealer Branch Name" type="string" defaultValue="Dealer Ford Oshakati" />
</camunda:formData>
<camunda:inputOutput>
<camunda:outputParameter name="bankList">
<camunda:list>
<camunda:value>"Nedbank"</camunda:value>
<camunda:value>"Wesbank"</camunda:value>
</camunda:list>
</camunda:outputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_1y7tces</bpmn:incoming>
<bpmn:outgoing>Flow_0lniorh</bpmn:outgoing>
</bpmn:userTask>
<bpmn:sequenceFlow id="Flow_0vocsrk" sourceRef="Activity_12ulcmq" targetRef="Event_1hmtjlj" />
<bpmn:userTask id="Activity_12ulcmq" name="Verify">
<bpmn:incoming>Flow_1z0thw4</bpmn:incoming>
<bpmn:outgoing>Flow_0vocsrk</bpmn:outgoing>
</bpmn:userTask>
<bpmn:subProcess id="Activity_06jgksu">
<bpmn:incoming>Flow_0lniorh</bpmn:incoming>
<bpmn:outgoing>Flow_1z0thw4</bpmn:outgoing>
<bpmn:multiInstanceLoopCharacteristics isSequential="true" camunda:collection="bankList" camunda:elementVariable="bankName" />
<bpmn:startEvent id="Event_0wqtg69" name="Start">
<bpmn:outgoing>Flow_0hgd1hz</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:businessRuleTask id="Activity_1xei8yl" name="Lookup Contacts for Branch" camunda:resultVariable="bankContact" camunda:decisionRef="bankContacts" camunda:mapDecisionResult="singleResult">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:outputParameter name="bankContactList">
<camunda:script scriptFormat="javascript">print("decisionResult: " + bankContact);
var scriptList = bankContactList;
print("internal result List before: " + bankContactList);
scriptList.add(bankContact);
print("internal result List after: " + scriptList);
scriptList;</camunda:script>
</camunda:outputParameter>
</camunda:inputOutput>
<camunda:executionListener event="start">
<camunda:script scriptFormat="javascript">print("inputValue: " + bankName);</camunda:script>
</camunda:executionListener>
</bpmn:extensionElements>
<bpmn:incoming>Flow_0hgd1hz</bpmn:incoming>
<bpmn:outgoing>Flow_07pekak</bpmn:outgoing>
</bpmn:businessRuleTask>
<bpmn:sequenceFlow id="Flow_0hgd1hz" sourceRef="Event_0wqtg69" targetRef="Activity_1xei8yl" />
<bpmn:endEvent id="Event_192ynmg" name="End">
<bpmn:incoming>Flow_07pekak</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_07pekak" sourceRef="Activity_1xei8yl" targetRef="Event_192ynmg" />
</bpmn:subProcess>
<bpmn:sequenceFlow id="Flow_0lniorh" sourceRef="Activity_150a9fv" targetRef="Activity_06jgksu" />
<bpmn:sequenceFlow id="Flow_1z0thw4" sourceRef="Activity_06jgksu" targetRef="Activity_12ulcmq" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="TestProcess">
<bpmndi:BPMNEdge id="Flow_1y7tces_di" bpmnElement="Flow_1y7tces">
<di:waypoint x="208" y="180" />
<di:waypoint x="260" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0vocsrk_di" bpmnElement="Flow_0vocsrk">
<di:waypoint x="920" y="180" />
<di:waypoint x="972" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0lniorh_di" bpmnElement="Flow_0lniorh">
<di:waypoint x="360" y="180" />
<di:waypoint x="410" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1z0thw4_di" bpmnElement="Flow_1z0thw4">
<di:waypoint x="760" y="180" />
<di:waypoint x="820" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Event_1ultm1a_di" bpmnElement="Event_1ultm1a">
<dc:Bounds x="172" y="162" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="157" y="205" width="67" height="40" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0cku7yz_di" bpmnElement="Activity_150a9fv">
<dc:Bounds x="260" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1hmtjlj_di" bpmnElement="Event_1hmtjlj">
<dc:Bounds x="972" y="162" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="962" y="205" width="56" height="40" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0uq7x33_di" bpmnElement="Activity_12ulcmq">
<dc:Bounds x="820" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_06jgksu_di" bpmnElement="Activity_06jgksu" isExpanded="true">
<dc:Bounds x="410" y="80" width="350" height="200" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_0hgd1hz_di" bpmnElement="Flow_0hgd1hz">
<di:waypoint x="486" y="180" />
<di:waypoint x="520" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_07pekak_di" bpmnElement="Flow_07pekak">
<di:waypoint x="620" y="180" />
<di:waypoint x="662" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Event_0wqtg69_di" bpmnElement="Event_0wqtg69">
<dc:Bounds x="450" y="162" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="456" y="205" width="24" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1xei8yl_di" bpmnElement="Activity_1xei8yl">
<dc:Bounds x="520" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_192ynmg_di" bpmnElement="Event_192ynmg">
<dc:Bounds x="662" y="162" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="670" y="205" width="20" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>