Hi all,
i have the following issue:
I have created a modeler with bpmn.io . The reason was that at some points in the process the user wants to have configuration options. (This is done before the process is released) These options should be shown in a form. My idea was to model this form (like the generated Forms can be created). The questions is how can I access them with the BPMN Model API? Is it possible to create an own Class like the CamundaFormData and load them with the following method? Or do should I use a “normal” XML API?
extensionElements.getElementsQuery().filterByType(CamundaFormData.class).singleResult();
XML:
<bpmn:startEvent id="StartEvent_1">
<bpmn:extensionElements>
<ownElement:form>
<ownElement:groupField id="GroupField_35ed3ia">
<ownElement:formData>
<ownElement:formField id="FormField_2pgt0fl" />
<ownElement:formField id="FormField_1k3bc92" />
<ownElement:formField id="FormField_0mveg4n" />
</ownElement:formData>
</ownElement:groupField>
<ownElement:groupField id="GroupField_334n1h5">
<ownElement:formData>
<ownElement:formField id="FormField_3soavdb" />
<ownElement:formField id="FormField_3667s9o" />
</ownElement:formData>
</ownElement:groupField>
<ownElement:groupField id="GroupField_2tqoglf">
<ownElement:formData>
<ownElement:formField id="FormField_3fs39ps" />
<ownElement:formField id="FormField_2p3akjh" />
</ownElement:formData>
</ownElement:groupField>
</ownElement:form>
</bpmn:extensionElements>
</bpmn:startEvent>
Thanks!
Dominik
Solved it
Did it like CamundaFormData and the CamundaFormDataImpl
Just had to Add them like it is done in the Bpmn Method doRegisterTypes
OwnFormImpl.registerType(Bpmn.INSTANCE.getBpmnModelBuilder());
OwnGroupFieldImpl.registerType(Bpmn.INSTANCE.getBpmnModelBuilder());
@thorben @dominikh is there an example of how to access custom extension elements from bpmn, Here is my BPMN XML file with custom namespace called cus, I want to access cutomerId and customerName from the extension elements in my listeners and HistoryEventHandler, at the same time I do not want to add them as extension properties because that probably would expose these values if someone downloads the model.
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance ” 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:cus=“http://customer.domain.com ” id=“Definitions_1” targetNamespace=“http://bpmn.io/schema/bpmn ” exporter=“Camunda Modeler” exporterVersion=“3.7.2”>
<bpmn:process id=“TestSingleUsertaskOlyExtensionElements” name=“TestSingleUsertaskOlyExtensionElements” isExecutable=“true” camunda:versionTag=“V1”>
bpmn:extensionElements
cus:customerId cus-hrkf87pv9a</cus:customerId>
cus:customerName cus-213232</cus:customerName>
</bpmn:extensionElements>
<bpmn:startEvent id=“StartEvent_1”>
bpmn:extensionElements
<camunda:executionListener class=“TestJava” event=“start” />
</bpmn:extensionElements>
bpmn:outgoing Flow_07exjn4</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id=“Flow_07exjn4” sourceRef=“StartEvent_1” targetRef=“TestHarishSingleTask” />
<bpmn:sequenceFlow id=“Flow_1kqqkrn” sourceRef=“TestHarishSingleTask” targetRef=“Event_0iun2ar” />
<bpmn:endEvent id=“Event_0iun2ar”>
bpmn:incoming Flow_1kqqkrn</bpmn:incoming>
</bpmn:endEvent>
<bpmn:userTask id=“TestHarishSingleTask” name=“TestHarishSingleTask”>
bpmn:incoming Flow_07exjn4</bpmn:incoming>
bpmn:outgoing Flow_1kqqkrn</bpmn:outgoing>
</bpmn:userTask>
</bpmn:process>
<bpmndi:BPMNDiagram id=“BPMNDiagram_1”>
<bpmndi:BPMNPlane id=“BPMNPlane_1” bpmnElement=“TestSingleUsertaskOlyExtensionElements”>
<bpmndi:BPMNEdge id=“Flow_1kqqkrn_di” bpmnElement=“Flow_1kqqkrn”>
<di:waypoint x=“360” y=“120” />
<di:waypoint x=“516” y=“120” />
<di:waypoint x=“516” y=“130” />
<di:waypoint x=“672” y=“130” />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id=“Flow_07exjn4_di” bpmnElement=“Flow_07exjn4”>
<di:waypoint x=“209” y=“120” />
<di:waypoint x=“260” y=“120” />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id=“_BPMNShape_StartEvent_2” bpmnElement=“StartEvent_1”>
<dc:Bounds x=“173” y=“102” width=“36” height=“36” />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id=“Activity_09gmeyv_di” bpmnElement=“TestHarishSingleTask”>
<dc:Bounds x=“260” y=“80” width=“100” height=“80” />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id=“Event_0iun2ar_di” bpmnElement=“Event_0iun2ar”>
<dc:Bounds x=“672” y=“112” width=“36” height=“36” />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Been asked a few times about Extensions on elements.
You generally have to parse the xml to get the result elements.
So i threw together a little helper script for this:
function getExtensions(elementId, returnJson) {
var modelInstance = execution.getBpmnModelInstance()
var elementInstance = modelInstance.getModelElementById(elementId)
var extensionElements = elementInstance.getExtensionElements().getElementsQuery().filterByType(Java.type('org.camunda.bpm.model.bpmn.instance.camunda.Ca…
Follow the same pattern as above, but you can use ExtensionElements (Camunda BPM Javadocs 7.14.20-ee) instead.
@StephenOTT thank you for the quick response, I think I am able to retrieve the extension elements when they are added as properties under extension tab either at process level or at task level, But not able to retrieve them when I do have my own custom namespace with extension elements within my namespace
Example :
as extension elements directly with my own cus namespace
bpmn:extensionElements
cus:id sr-4328n0qonq</cus:id>
cus:name ten-hrkf87pv9a</cus:name>
</bpmn:extensionElements>
instead of extension properties that uses camunda namespace
bpmn:extensionElements
camunda:properties
<camunda:property name=“cus:name” value=“tn-2132432sad” />
<camunda:property name=“cus:id” value=“sr-aasdsa2324” />
</camunda:properties>
</bpmn:extensionElements>