I started with Camunda about 2 weeks ago to implement a quite simple request-approval process for equipment.
In my process I have on my startEvent an embedded form to get all request properties. For the select options of a drop down list I need to call some Java code before the request form is displayed to get the available options.
I tried
a) a start listener on the startEvent
b) a start listener on the process instance itself
but both are not working as I would expect.
This results in this process definition:
<bpmn:process id="lend-equipment2" name="Equipment leihen" isExecutable="true">
<bpmn:extensionElements>
<camunda:executionListener class="com.msggroup.lend.equipment.process.ProcessInstanceStartListener" event="start" />
<camunda:executionListener event="start">
<camunda:script scriptFormat="groovy"><![CDATA[println "groovy process instance start listener fired"]]></camunda:script>
</camunda:executionListener>
</bpmn:extensionElements>
<bpmn:startEvent id="eqRequestReceived" name="Equipment Request Received" camunda:formKey="embedded:app:forms/request-equipment.html">
<bpmn:extensionElements>
<camunda:executionListener class="com.msggroup.lend.equipment.process.EquipmentRequestReceivedStartListener" event="start" />
<camunda:executionListener class="com.msggroup.lend.equipment.process.EquipmentRequestReceivedEndListener" event="end" />
</bpmn:extensionElements>
<bpmn:outgoing>SequenceFlow_0yn09ba</bpmn:outgoing>
</bpmn:startEvent>
None of these start listeners are fired before the startEvent form is opened. Surprisingly start and end listeners are fired together, after the red Start button is clicked.
This is quite obvious looking at the time stamps of the events in the log:
The log entries for process instance start, startEvent start and startEvent end listeners are fired all 9:41:41 - in same second.
These unexpected behavior leads me to the following questions:
- Could anybody explain the listeners concept, the intention of them and my misunderstanding, please? (I read the docu before I tried)
- Or is this a bug in my version 7.6.0, modeler 1.5.1?
- Are start listeners at all the right way to set variable in the startEvent form before it appear? Or is this not working by design?
- Is there another way to get the select options?
Would appreciate any hint.
Frank