Camunda-modeler: Mapping script to outputParameter using elementTemplates produces invalid BPMN

Created on 10 Mar 2021  路  3Comments  路  Source: camunda/camunda-modeler

__Describe the Bug__

It is not possible to properly map script to output parameter using element templates.
When source property is specified in binding, name property is not defined, thus produced bpmn file is incorrect and cannot be deployed in process engine.

__Steps to Reproduce__

  1. Insert following code into some element template:
    ```"scopes": {
    "camunda:Connector": {
    "properties": [
    {
    "label": "ConnectorId",
    "type": "Hidden",
    "value": "http-connector",
    "binding": {
    "type": "property",
    "name": "connectorId"
    }
    },
    {
    "label": "Method",
    "type": "String",
    "value": "GET",
    "binding": {
    "type": "camunda:inputParameter",
    "name": "method"
    }
    },
    {
    "label": "URL",
    "type": "String",
    "value": "http://dummy.restapiexample.com/api/v1/employee/1",
    "binding": {
    "type": "camunda:inputParameter",
    "name": "url"
    }
    },
    {
    "label": "Response",
    "type": "Hidden",
    "binding": {
    "type": "camunda:outputParameter",
    "source": "S(response).prop(\"data\").prop(\"email\")"
    }
    }
    ]
    }
    }

2. Apply template to task in modeler

Actual result in bpmn file:

![obraz](https://user-images.githubusercontent.com/18292081/110627798-b073db80-81a2-11eb-96e7-8aceb50f9b69.png)

This file cannot be deployed due to missing **name** property:

> ENGINE-09005 Could not parse BPMN process. Errors: 
> * Missing attribute 'name' for outputParameter | resource diagram_1.bpmn | line 18 | column 38 [ deploy-error ]

__Expected Behavior__

I want to have following content in bpmn file:
![obraz](https://user-images.githubusercontent.com/18292081/110629568-94713980-81a4-11eb-8189-9874721f1e80.png)
which can be deployed to the process engine.

It could be potentially fixed by allowing binding both name and source property:

{
"label": "Response",
"type": "Hidden",
"binding": {
"type": "camunda:outputParameter",
"name": "myName",
"source": "S(response).prop(\"data\").prop(\"email\")"
}
}
```

__Environment__

  • OS: Windows 10 1909
  • Camunda Modeler Version: 4.6.0
bug cannot reproduce

All 3 comments

Thanks for reporting.

Please note that the value of the property will be set to the output parameter's name, since that's what the user is supposed to type in (cf. documentation)

This template works for me

[
  {
    "name": "My Task",
    "id": "foo",
    "appliesTo": [
      "bpmn:ServiceTask"
    ],
    "properties": [ ],
    "scopes": {
      "camunda:Connector": {
        "properties": [
          {
            "label": "Response",
            "type": "Hidden",
            "value": "myName",
            "binding": {
              "type": "camunda:outputParameter",
              "source": "S(response).prop(\"data\").prop(\"email\")"       
            }
          }
        ]
      }
    }
  }
]

However, I also see that this might be confusing since the binding is supposed to set the specified properties in the XML, so also the name. That's something we don't support at the moment, you can refer to the supported binding properties in our documentation.

If it's okay for you, and the workaround with setting the value works for you, I can imagine transforming this issue to a feature request adding support for the name binding.

Thanks for reply and help! Your solution works perfectly, seems that I unfortnately overlooked it while reading the documentation :-(
I'll soon report separate feature request for support of explicit binding using name property and close this bug.

Thanks! I'll close this issue then, you can refer to it when you open another one 馃憤

Was this page helpful?
0 / 5 - 0 ratings