Element template with Drowdown with camunda:field binding has no value


#1

When setting up a custom element template and using a Dropdown Type, with a binding type of camunda:field the value chosen by the user is never saved anywhere. With a Text Type the value is saved as a camunda:string within the camunda:field. How can I use a dropdown but have it inject the user selected value into a camunda:field?

Camunda modeler version: 2.2.4

This configuration produces a value in the bpmn xml:
{
“label”: “Payload”,
“type”: “Text”,
“value”: “”,
“editable”: true,
“binding”: {
“type”: “camunda:field”,
“name”: “Payload”
}
}
If I input “abcd” into the Payload field I get xml that looks like this:
<camunda:field name=“Payload”>
camunda:stringabcd</camunda:string>
</camunda:field>

This configuration produces no value in the xml:
{
“label”: “ReadTimeout”,
“type”: “Dropdown”,
“choices”: [
{ “name”: “15s”, “value”: “15” },
{ “name”: “30s”, “value”: “30” },
{ “name”: “60s”, “value”: “60” },
{ “name”: “120s”, “value”: “120” },
{ “name”: “300s”, “value”: “300” }
],
“binding”: {
“type”: “camunda:field”,
“name”: “ReadTimeout”
}
}

If I select “15s” from the ReadTimeout drop down I get this xml:
<camunda:field name="ReadTimeout" />


#2

Hi @marshall.burns,

here is what you can do:
In the binding element set

“type”: “camunda:inputParameter”
“name”: “readTimeout”

instead of “type”: “camunda:field”.

This will ensure, that the value is passed as a process variable and you will be able to get the value of this variable with the normal method call:

execution.getVariable(“readTimeout”);

Hope that helps.

Regards
Michael


#3

After some further experimentation I found that camunda:field type does produces a camunda:string subelement but only when you change the dropdown to another value besides the first choice. As a workaround to resolve the problem you can set the default value on the dropdown to be the same as the value of the first choice. However I still consider this a bug, and a confusing one that was defintiely a big time waster tracking it down for me and my team.