Setting CandidateGroup from form filled in previous task

Writing this up even though I know that there is a lot of info, I wasn’t able to pull it off and spent close to 2 full days on this. Note that I am trying to use just the modeler application, haven’t taken this to eclipse yet, because I am sure there is a way to do it without doing that

The job really is to feed in a candidateGroup to process in a user task (through a form in that task), and then in the next user task onwards, assign the task to that candidate group.

Here is what I have tried so far:

  1. Set ${candidateGroupId} on “Assignments”->Candidate Groups, where candidateGroupId is the id of the form field in the previous user task. This moves onto the next step but is assigned to no-one.

  2. I tried using task listeners for this. So in the task Listener, I used that expression on create ${task.addCandidateGroup(var:get(candidateGroupId))}, and a bunch of different permutations as well, and that behaves the same as above. Funnily enough, if i replace the var:get… portion with the hardcoded string of the id of one of the candidate groups, that seems to work?

  3. I have tried setting execution and task variables as well, and none of those seem to work as it cant find the property.

Any tips on what I must be missing out here? It seems to be a realllly straight forward thing which is why I am not sure what I am doing wrong here.

In addition to this, I have noticed that the candidateGroupId is null, after setting a ScriptTaskListener on complete event of the first step. That means it never gets saved?

Can you share the bpmn xml you’ve got so far, that would help a lot.

That should be ok. What happens if you don’t use a function, but execution.getVariable or candidateGroupId direclty? Like ${task.addCandidateGroup(candidateGroupId)}

I’m not sure why a ScriptTaskListener would be needed here. Isn’t a regular expression on the task listener ok?

Anyway, this should indeed just work, if we have the bpmn xml it’s going to be easier to give relevant pointers :slight_smile:

<?xml version="1.0" encoding="UTF-8"?> ExclusiveGateway_0tves3v EndEvent_0ripgde ServiceTask_0zg9r2s mailtask1 mailtask2 sid-6DD3A6ED-4DF4-4CE0-87D3-72D9734EC3B9 SequenceFlow_10dcogo SequenceFlow_0ikchw3 SequenceFlow_0uabgth StartEventProcessStarted UserTask_0ot7gwv UserTask_1ncbr05 UserTask_0ognoho EndEventProcessEnded boundary SequenceFlow_1gmikym SequenceFlow1 SequenceFlow_1an0g5b sid-2F54CAC5-AACA-4297-9929-9D6481609E7C SequenceFlow_113vdzc sid-63A5665E-7F0C-470A-A998-5A0D5B2292A5 PT10S













<bpmndi:BPMNDiagram id=“BPMNDiagram_Collaboration”>
<bpmndi:BPMNPlane bpmnElement=“Collaboration” id=“BPMNPlane_Collaboration”>
<bpmndi:BPMNShape bpmnElement=“Participant_0n6x8wz” id=“BPMNShape_Participant_0n6x8wz”>
<omgdc:Bounds height=“605.0” width=“1218.0” x=“156.0” y=“65.0”></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement=“Lane_1525i68” id=“BPMNShape_Lane_1525i68”>
<omgdc:Bounds height=“415.0” width=“1188.0” x=“186.0” y=“255.0”></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement=“ExclusiveGateway_0tves3v” id=“BPMNShape_ExclusiveGateway_0tves3v”>
<omgdc:Bounds height=“40.0” width=“40.0” x=“761.0” y=“455.0”></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement=“EndEvent_0ripgde” id=“BPMNShape_EndEvent_0ripgde”>
<omgdc:Bounds height=“28.0” width=“28.0” x=“1020.0” y=“405.0”></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement=“ServiceTask_0zg9r2s” id=“BPMNShape_ServiceTask_0zg9r2s”>
<omgdc:Bounds height=“80.0” width=“100.0” x=“570.0” y=“435.0”></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement=“mailtask1” id=“BPMNShape_mailtask1”>
<omgdc:Bounds height=“80.0” width=“100.0” x=“570.0” y=“285.0”></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement=“mailtask2” id=“BPMNShape_mailtask2”>
<omgdc:Bounds height=“80.0” width=“100.0” x=“300.0” y=“285.0”></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement=“Lane_0r6sr76” id=“BPMNShape_Lane_0r6sr76”>
<omgdc:Bounds height=“190.0” width=“1188.0” x=“186.0” y=“65.0”></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement=“StartEventProcessStarted” id=“BPMNShape_StartEventProcessStarted”>
<omgdc:Bounds height=“30.0” width=“30.0” x=“240.0” y=“120.0”></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement=“UserTask_0ot7gwv” id=“BPMNShape_UserTask_0ot7gwv”>
<omgdc:Bounds height=“80.0” width=“100.0” x=“570.0” y=“105.0”></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement=“UserTask_1ncbr05” id=“BPMNShape_UserTask_1ncbr05”>
<omgdc:Bounds height=“80.0” width=“100.0” x=“300.0” y=“90.0”></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement=“UserTask_0ognoho” id=“BPMNShape_UserTask_0ognoho”>
<omgdc:Bounds height=“80.0” width=“100.0” x=“885.0” y=“105.0”></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement=“EndEventProcessEnded” id=“BPMNShape_EndEventProcessEnded”>
<omgdc:Bounds height=“28.0” width=“28.0” x=“1230.0” y=“75.0”></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement=“boundary” id=“BPMNShape_boundary”>
<omgdc:Bounds height=“31.0” width=“31.0” x=“564.5601444806182” y=“170.01869400517”></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement=“SequenceFlow_0ikchw3” id=“BPMNEdge_SequenceFlow_0ikchw3”>
<omgdi:waypoint x=“781.2977611940298” y=“455.29850746268653”></omgdi:waypoint>
<omgdi:waypoint x=“786.0” y=“145.0”></omgdi:waypoint>
<omgdi:waypoint x=“884.9999999999834” y=“145.0”></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement=“SequenceFlow_1gmikym” id=“BPMNEdge_SequenceFlow_1gmikym”>
<omgdi:waypoint x=“620.0” y=“184.95”></omgdi:waypoint>
<omgdi:waypoint x=“620.0” y=“285.0”></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement=“SequenceFlow_0uabgth” id=“BPMNEdge_SequenceFlow_0uabgth”>
<omgdi:waypoint x=“800.5626585928461” y=“475.38365384615383”></omgdi:waypoint>
<omgdi:waypoint x=“1036.0” y=“480.0”></omgdi:waypoint>
<omgdi:waypoint x=“1036.0” y=“458.9499750252922”></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement=“sid-2F54CAC5-AACA-4297-9929-9D6481609E7C” id=“BPMNEdge_sid-2F54CAC5-AACA-4297-9929-9D6481609E7C”>
<omgdi:waypoint x=“564.5601407974265” y=“186.01869400517”></omgdi:waypoint>
<omgdi:waypoint x=“350.0” y=“186.01869400517”></omgdi:waypoint>
<omgdi:waypoint x=“350.0” y=“285.0”></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement=“SequenceFlow1” id=“BPMNEdge_SequenceFlow1”>
<omgdi:waypoint x=“269.92970434779033” y=“134.2115980805558”></omgdi:waypoint>
<omgdi:waypoint x=“299.99999999999966” y=“132.62894736842105”></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement=“SequenceFlow_1an0g5b” id=“BPMNEdge_SequenceFlow_1an0g5b”>
<omgdi:waypoint x=“984.9499999999658” y=“145.0”></omgdi:waypoint>
<omgdi:waypoint x=“1244.0” y=“145.0”></omgdi:waypoint>
<omgdi:waypoint x=“1244.0” y=“102.94995046207684”></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement=“SequenceFlow_113vdzc” id=“BPMNEdge_SequenceFlow_113vdzc”>
<omgdi:waypoint x=“399.95000000000005” y=“149.97737556561086”></omgdi:waypoint>
<omgdi:waypoint x=“569.9999999999999” y=“146.13009049773754”></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement=“sid-63A5665E-7F0C-470A-A998-5A0D5B2292A5” id=“BPMNEdge_sid-63A5665E-7F0C-470A-A998-5A0D5B2292A5”>
<omgdi:waypoint x=“399.95” y=“120.0726392251816”></omgdi:waypoint>
<omgdi:waypoint x=“556.5” y=“89.0”></omgdi:waypoint>
<omgdi:waypoint x=“1230.0” y=“89.0”></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement=“SequenceFlow_10dcogo” id=“BPMNEdge_SequenceFlow_10dcogo”>
<omgdi:waypoint x=“669.9499999999999” y=“475.0”></omgdi:waypoint>
<omgdi:waypoint x=“761.0” y=“475.0”></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement=“sid-6DD3A6ED-4DF4-4CE0-87D3-72D9734EC3B9” id=“BPMNEdge_sid-6DD3A6ED-4DF4-4CE0-87D3-72D9734EC3B9”>
<omgdi:waypoint x=“620.0” y=“364.95000000000005”></omgdi:waypoint>
<omgdi:waypoint x=“620.0” y=“435.0”></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>

That what the bpmn xml looks like

And yes you are right, a ScriptTaskListener is not required, but the simple expression on the task listener didnt work so I was trying every other alternative.

I tried using execution.getVariable or cadidadateGroupId directly, it gave the same result as I mentioned, that it doesn’t add the candidate group. It only really works if the value that I am expecting is hardcoded in.

In the above bpmn xml, the variable is called assigneegroup because that is the id of the form field that is supplied the value. Perhaps there is something I can do the in form itself to help the cause?

The xml seems to have not been added properly, can you add the missing part (which has the important bits for this discussion)?