CallActivity loop on Collection: Expression didn't resolve to type 'Collection'

I have a process with a CallActivity which I want to loop on a Collection and inject in each child an item.

image

The start of the process is made with REST API:

uatsitecolls is created on the process instance as a Json object:

But when the CallActivity try to be executed I got:

Any help?
Thanks,

Hi @valiu,

you have to be aware of the fact, that a Multi Instance tasks expects an object of a “Java Collections”-Type as input. Other objects can not be passed to this task. An element of the Java Collections is something like a LinkedList or an ArrayList. So make sure you choose the right data type when using and calling this task.
This is the reason why it is saying “${uatsitecolls} didn’t resolve to type Collection”, because it is not something of a Java Collection, it is a JSON String.

Hope this helps.

Regards
Michael

@valiu take a look at the JSON Spin API Reading JSON | docs.camunda.org. You need to return a collection from the SPIN json.

myJsonVar.elements() would return the collection rather than the SPIN object.

see the following for more detailed explanation:

@MichiDahm When it was stored as type json, its a java object its just not a “collection”, so they have to use the .elements() methods on the JSON SPIN object as per above.

1 Like

@StephenOTT

Yes, you are right. Thanks for the addition :grinning:

Thank you guys for the info.
Indeed, now I get the Java Collection from the Json object by calling elements() method and the CallActivity artefact can iterate over it.

image

1 Like