Javascript format


#1

Hi
I created a userTask which inside it i created a form by long type and “number” name .
After that , i created a script task with groovy script type and i put this code inside script area :

def collection =  ['a','b','c','d','e'] 
def second = [] 
for(int i = 0;i<number;i++) {
second.add(collection.get(i)) 
      }

execution.setVariable("second", second)

After that , i created a multi instanse userTask and i passed “second” in collection section .

Now , when i deploy the bpmn file and test in camunda engine , in first of test , i must put a number and based on that number , will create different userTask .
This is exactly what i want .

But for now , i want to use a string type in first form instead of long type .
And in test step , inside that i want to put different arrays ( for example like : [‘a’,‘b’,‘c’] ) and in output should create different userTask by ( a , b , c ) names .

And i want to use javascript format .
But i don’t have any idea .


#2

can i use Json like this ?

    var collection = JSON.parse(number)
execution.setVariable("second", second)