Hello,
I am using a mult-instance service task like this

where the collection is a list of maps.
In the input parameters, I do not want to use the whole element, but specific entries from it. How can I access the element values in the input parameters?
I have tried execution.getVariable(“element”) and execution.getVariableLocal(“element”) but it did not work.
Thanks.
Hi @cambarantama
If element
is supposed to be a Java map then something similar to below should work
<extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="elemValue">
${element["keyName"]}
</camunda:inputParameter>
</camunda:inputOutput>
</extensionElements>
Notice: keyName should be replaced with the key name for the specific entry to be accessed
I see that your input parameter is of type map so you can use an expression similar to the below expression as a value for the entry
${element["keyName"]}
I didn’t try myself but I believe it should work
Hi @hassang,
I tried this but it does not work. If fails with this error:
Unknown property used in expression: ${element["keyName"]}. Cause: Cannot resolve identifier 'element'
Okay
Instead of using a multi-instance service task, you need to use a multi-instance sub-process and put the service task into it.
Attached is a working example
test-multi-instance.bpmn (5.9 KB)
1 Like