Could you help me, please, to understand what’s wrong with my BPMN Diagram for Camunda 8 Multi-instance subprocess ?
I try to create subprocess with Input collection in Multi-instance like:
But when I created the same throw Input by Local variable ‘namesArray’, I received an Error: Expected result of the expression ‘namesArray’ to be ‘ARRAY’, but was ‘STRING’.
The documentation tells me:
A multi-instance activity must have an inputCollection expression that defines the collection to iterate over (e.g. = items). Usually, it accesses a variable of the process instance that holds the collection.
Hi @volodya327 - I ran your Multi-instance_subprocess_User model in Play Mode in Web Modeler and it executed without error. How are you trying to start the instance when you get that error?
@volodya327 - apologies, I didn’t look deep enough. Because Enter List of Names is a User Task with a form attached, the result of the form is being applied to the namesArray variable. The form field is a text field, and you can see in your second screenshot that the array has indeed been turned into a string (the double quotes and escaped quotes are indicators of that).
What are you trying to test or learn about? There are several ways to accomplish this, and without knowing what direction you’d like to go I don’t know what suggestions to make! For instance, you could define the namesArray value on the start event, or you could send the data up with an API request to start the process, or you could just change the form to not overwrite the variable value.
Hi nathan.loding !
Thanks for your replay. The idea is to create variable number of assigned User Tasks in parallel. The number of users is not known at the start and can be dynamicaly set by somebody in process.
This “somebody” can be a User with Web UI or JobWorker. So info about inputCollection can be in process variable.
@volodya327 - how you model it is largely going to be determined by where that collection is coming from. For your simple example above, I think that renaming the form variable from namesArray to something else will be enough to get it working.
One related note as you get further into development: to assign a task to a user, you need their unique user ID, not just a name. The unique ID varies depending on the environment and how you authenticate. See this section in our docs for more info!