How to split process variable and set the result in list or map

I have a workflow with a form embeded which contains 2 fields:

  • Number of sites to instance
  • Sites Ids wich have differents keys seperated by “-”

When I generate the instance:

  • I would like to split the variable and set data in list or map
  • When generating any instance, I will allow the Id to the instance and update the name of the task.

I don’t know how the configure the modeler to do this action.
This is the idea I want to implement:

//get the field value`
var arrayKeys = execution.getVariable("sitesInjectes");
//split value and set it in list or map
execution.setVariable("arrayKeys", split(arrayKeys, "-"));

// when generate instance, I can view the Id

Please could you help me to solve this issue.
Find below my BPMN and form.
form-identify-site-split.form (585 Bytes)
test_identify-instance-split-task.bpmn (6.1 KB)
Thanks for your help,

I try to implement this but It seems like the array is not set by the data.
I have this error :

Cannot submit task form 98d4a8a1-4bc4-11ed-8212-74782729eca5: Unable to evaluate script:org.graalvm.polyglot.PolyglotException: TypeError: Cannot read property '0' of null

This is my Bpmn file.
test_identify-instance-split-task.bpmn (6.8 KB)

Thanks for help,


There are multiple parts to this problem:

  1. First, we want to split a single string into a list of strings
  2. We want to use a multi-instance subprocess to iterate over this list.

For each task, we can define input and output mappings. To calculate local input variables and global outputs. A common use case are simple data transformations. In your case, I recommend adding an output definition to the user task “NUMBER OF INSTANCE”. This output mapping does the following:

  1. It takes the string input sitesInjectes
  2. Splits it at the deliminator “-” and thereby creates an array
  3. It transforms the array into an ArrayList
  4. It creates a new process variable arrayKeys that holds this list

In groovy, the script would look something like this:

// Split the string into an array
arrayKeys = sitesInjectes.split("-");
// Create an Array list
listKeys = new ArrayList();
// Add the elements to the list
for (key in arrayKeys) {

In detail, add the following configuration to your task:

Next, we need to configure your multi-instance subprocess so that it iterates over the keys in the variable listKeys. The following configuration creates an instance for each key in listKeys. The key can be accessed via the variable key:

You may also check out the newest features in Camunda 7.18 and the modeler 5.4.1. There you have a new input element, called taglist, to enter a list of strings.


Hi @StephanHaarmann ,

Thanks for the solution. I appreciate the method.

I will follow your advice for the newest features in camunda 7.18 and the modeler 5.4.1