cancel
Showing results for 
Search instead for 
Did you mean: 

Collection variable en REST API

harold
Champ in-the-making
Champ in-the-making
I 'm using a multi instance task in activiti, and when i start a process, i post a variable which will be use in the multi itance "Collection". Each time, Activiti has an error message such as "Varaible …. is not a Collection". I don't find in the documentation how to set with the REST Api à colletion variable. I tried this, but it didn't work :
"variable" : "[1,2,3]"
"variable" : "{1,2,3}"
How ca i set a Collection Variable with the REST API please ?

Thanks
8 REPLIES 8

jbarrez
Star Contributor
Star Contributor
I don't believe it is currently supported in the rest api like that. A serialized arraylist might work.

But nointheless, it makes sense to have it. Could you create a jira issue to follow up?

harold
Champ in-the-making
Champ in-the-making
Hello
I apologize; it work well Smiley Happy , it was a mistake
Sorry

jbarrez
Star Contributor
Star Contributor
Okay - thanks for posting back though

busy
Champ in-the-making
Champ in-the-making
I can't find the way of starting a process with REST which has got a variable (called list_of_assignees) type string.
I use the variable in a loop this way:
<multiInstanceLoopCharacteristics isSequential="false" activiti:collection="${list_of_assignees}" activiti:elementVariable="assignee"></multiInstanceLoopCharacteristics>

When I try to start the process setting a list of user names (comma separated), the errorMessage shows that the variable 'didn't resolve to a Collection'.
Could anybody give me a hand?
Thanks in advance

trademak
Star Contributor
Star Contributor
Well, the error message basically says it all. The variable needs to be a Collection and not a comma separated string.

Best regards,

busy
Champ in-the-making
Champ in-the-making
Of course, but there is no kind of "collection" data type, right?
So, should I include some scriptTask to turn the string into a collection?
Any help will be welcome!

jbarrez
Star Contributor
Star Contributor
> to turn the string into a collection

That's an option.

I don't know from the top of my head which data types the rest api accepts. But a collection of primitive data types should be there, if not it would be most useful to add it.

busy
Champ in-the-making
Champ in-the-making
Thanks for your answer.
I managed to start the process posting the variable (string) as a collection this way:
"value":["USER1","USER2"]
, it was just a JSON question 🙂