I have added some extension variables to a ServiceTask and would like to get these element values from a JavaDelegate implementation. How should I solve this problem?
Best regasds,
Tom
Yes, I have inserted a custom extension element into bpmn.xml model. (Please find it below.)
<serviceTask id="ServiceTask_1" camunda:delegateExpression="${DelegateAS400Call}" name="Calling OV003A prg">
<extensionElements>
<camunda:properties>
<camunda:property value="OV003A_H" name="XMLInputName"/>
</camunda:properties>
</extensionElements>
<incoming>SequenceFlow_6</incoming>
<outgoing>SequenceFlow_1</outgoing>
</serviceTask>
I wanna get back the value ("OV003A_H") property from BPMN model API where name property = "XMLInputName".
I read the example You linked in, but couldn't solve this simple task. I always get empty value back.
Thanks in advance,
Tom
public void execute(DelegateExecution execution) throws Exception {
CamundaProperties camundaProperties = execution.getBpmnModelElementInstance().getExtensionElements().getElementsQuery()
.filterByType(CamundaProperties.class).singleResult();
Collection<CamundaProperty> properties = camundaProperties.getCamundaProperties();
for (CamundaProperty property : properties) {
System.out.println(property.getCamundaValue()); // --> "OV003A_H"
System.out.println(property.getAttributeValue("name")); // --> "XMLInputName"
}
}
Yes, this code works properly!
That's what I need.
Thanks for Your help!
Cheers,
Tom