Element templates with boolean on inputParameter breaks saving diagram

Hi,

I have a problem with element templates using Boolean type on camunda:inputParameter fields. When I select the template for a service task and change the status of the custom boolean field, I cannot save the diagram any more.

My template looks like that:

[
{
	"name" : "Test boolean",
	"id" : "test.boolean",
	"appliesTo": [
		"bpmn:ServiceTask"
	],
	"properties" : [
		{
			"label": "Boolean field",
			"type": "Boolean",
			"binding": {
				"type": "camunda:inputParameter",
				"name": "booleanValueString"
			}
		}
	],
	"entriesVisible": {
		"_all": true,
		"delegate": false,
		"implementation": false
	}
}
]

When now try to create a simple workflow start → service task → end, select the template on the service task and change the value of the checkbox, I cannot save the diagram anymore.

Is my element template wrong defined?

Thanks for help,

Alexander

Yes, this is because technically there does not exist a Boolean type there (see this issue for reference).

Use the string type and, as you indicate in your example with booleanValueString stuff will just work from the engine perspective.

Hi.

After some investigation, that’s what I found.

By now there is no correct way to bind template property with type Boolean to camunda:inputParameter with type Text (which is by default, if you not set “scriptFormat” in binding section)

You could see error by yourself (in Modeler open Developer Tools by F12 in Windows, go to Console tab, and after press Save). Some javascript expect String but get Boolean.

As alternative try use type Dropdown for this:

[
  {
    "name": "Test boolean",
    "id": "test.boolean",
    "appliesTo": [
      "bpmn:ServiceTask"
    ],
    "properties": [
      {
        "label": "Boolean field",
        "type": "Dropdown",
        "value": "${true}",
        "choices": [
          {
            "name": "True",
            "value": "${true}"
          },
          {
            "name": "False",
            "value": "${false}"
          }
        ],
        "binding": {
          "type": "camunda:inputParameter",
          "name": "booleanValueString"
        }
      }
    ],
    "entriesVisible": {
      "_all": true,
      "delegate": false,
      "implementation": false
    }
  }
]
1 Like

if it is not supported, why is it documented here?
https://github.com/camunda/camunda-modeler/tree/master/docs/element-templates

If the type String instead of Boolean is used as suggested, there will be no checkbox but a text field.

Where exactly do you see it documented?

Answer: Here?

As indicated in my previous answer you cannot assign a Boolean value to camunda:inputParameter because the value must be of type String.

The documentation relates to the fact that you can very well use a boolean checkbox for actual boolean values (Process#isExecutable, camunda:async, …).

The documentation states that there are allowed bindings such as “camunda:inputParameter” and allowed Types such as “Boolean”.

Therefore at least Alexander and i concluded that the combination “camunda:inputParameter” + “Boolean” is possible as well.

To solve the initial question it was necessary to apply the workaround suggested by ArtyomKosykh.
Because the workaround enables us to provide a selectable “yes”, “no” option to a process designer. Its just a combobox-list instead of a checkbox.

So for me this workaround was the answer which solved the question.