Hi Camunda community !
I’m trying to make an element template in the modeler to simplify request to REST APIs.
I made a dropdown list to select the method name and i want to auto display the associated rest method to avoid a manual dropdown selection.
I know that I can use conditions in the template and see below an extract of my code :
Blockquote
{
“id”:“url”,
“label”: “REST Method”,
“description”: “Specify method to use.”,
“type”: “Dropdown”,
“value”: “”,
“constraints”: {
“notEmpty”: true
},
“choices”: [
{ “name”: “findByIdOffreAndCodeEditeur”, “value”: “{{baseUrl}}/offre/{{idOffre}}/{{codeEditeur}}” },
{ “name”: “getBeginDate”, “value”: “{{baseUrl}}/offre/{{idOffre}}/{{codeEditeur}}/beginDate” },
{ “name”: “createSubscription”, “value”: “{{subscriptionBaseUrl}}/souscription” }
],
“binding”: {
“type”: “zeebe:input”,
“name”: “url”
}
},
{
“label”: “REST Method”,
“type”: “String”,
“editable”: false,
“value”: “GET”,
“binding”: {
“type”: “zeebe:input”,
“name”: “method”
},
“condition”: {
“property”: “url”,
“oneOf”: [“{{baseUrl}}/offre/{{idOffre}}/{{codeEditeur}}”,“{{baseUrl}}/offre/{{idOffre}}/{{codeEditeur}}/beginDate”, “{{subscriptionBaseUrl}}/souscription”]
}
},
{
“label”: “REST Method”,
“type”: “String”,
“editable”: false,
“value”: “POST”,
“binding”: {
“type”: “zeebe:input”,
“name”: “method”
},
“condition”: {
“property”: “url”,
“oneOf”: [“{{subscriptionBaseUrl}}/souscription”]
}
},
The problems is that it doesn’t work because GET and POST have the same binding name. It works if i use 2 different name but … I need only one name to use this variable in my worker.
I think that it can be fixed by using an expression in order to calculate the value dynamically.
Is it possible, or do you have some genius idea in order to solve this problem ?
Thanks for your time and have a nice day !