Multi instance task (REST API)

I’m using a multi instance task, and when I start a process, I post a variable which will be use in the multi
instance “Collection”.
Error: HTTP Status 500 - org.jboss.resteasy.spi.UnhandledException: java.lang.ClassCastException:
org.camunda.spin.impl.json.jackson.JacksonJsonNode cannot be cast to java.lang.String

Collection variable in Task block:

${S(’{“users”: [“peter”,“john”]}’).prop(“users”).elements()}

XML Task:

<bpmn:userTask id="UserTask_19" name="Task_Assignee" camunda:formKey="embedded:app:forms/1-assignee.html"  camunda:assignee="${assigneeInstance}">
      <bpmn:multiInstanceLoopCharacteristics camunda:collection="${S(&#39;{&#34;users&#34;: 
camunda:elementVariable="assigneeInstance" />

How can I set a Collection Variable with the REST API please ?

Thanks a lot for any help

Hi @ALeo,

your example works so far. There is only a small mistake in the assignee expression which must be ${assigneeInstance.stringValue()} because you iterate over a collection of JSON nodes.

Does this help you?

Best regards,

1 Like

@ALeo here is a example where we went through some more advanced usage of JSON arrays and Multi-instance tasks.

Philipp, thanks for your answer.