Hello friends,
I am trying to create the below XML using BPMNModdle.
<bpmn2:boundaryEvent id="Event_Interrupt_EngagePatient_1" attachedToRef="EngagePatient_1">
<bpmn2:extensionElements>
<camunda:executionListener event="end">
<camunda:script scriptFormat="javascript">execution.setVariable("interruptEventSource", "EngagePatient_1")</camunda:script>
</camunda:executionListener>
</bpmn2:extensionElements>
<bpmn2:outgoing>Flow_1qivg48</bpmn2:outgoing>
<bpmn2:messageEventDefinition id="MessageEventDefinition_1n4z3cm" messageRef="Message_01a7go0" />
</bpmn2:boundaryEvent>
I have successfully created the message/boundary-event using code. I am having trouble in generating the camunda:script
xml inside the camunda:executionListener
. Below is the code I have written for the script tag generation and adding it to the execution listener.
const scriptObj = {
scriptFormat: 'javascript',
//value: `execution.setVariable("interruptEventSource", "${step.id}__${step.stepType}")`
//resource: '/home/subhro/test.js',
}
const scriptElem = moddle.createAny('camunda:script', 'http://camunda.org/schema/1.0/bpmn', scriptObj)
const extObj = {
event: 'end',
script: scriptElem
}
const exeListenerElem = moddle.createAny('camunda:executionListener', 'http://camunda.org/schema/1.0/bpmn', extObj)
But this is not generating the right camunda:script xml. It is generating this wrong xml
<bpmn2:boundaryEvent id="InterruptBoundaryEvent_Step1" attachedToRef="Step1">
<bpmn2:extensionElements>
<camunda:executionListener event="end" script="[object Object]"/>
</bpmn2:extensionElements>
<bpmn2:outgoing>Flow_InterruptBoundaryEvent_Step1_ResetVariablesExternalServiceTask</bpmn2:outgoing>
<bpmn2:messageEventDefinition id="InterruptMessage_Ref_Step1" messageRef="InterruptMessage"/>
</bpmn2:boundaryEvent>
How do I generate the inner camunda:script
xml inside the camunda:executionListner
tag.
Please help.