taskServiceBean set variable with an array

How would one set the variable in a taskService bean as an array on the flowable ui modeler? I’ve tried numerous different approaches but none seem to work. It works fine setting the variable as a string or number but as soon as I set it as an array it throws errors while running the case in an app.

I’ve tried: ${taskServiceBean.setVariable(task.id,‘testVar’,java.util.Arrays.asList(“1”,“2”,“3”))}
${taskServiceBean.setVariable(task.id,‘testVar’, new String{“1”,“2”,“3”}))}
and a couple other similar attempts

Did you check whether returned List<> is serializable?
I do not recommend to use java serialization for var store.


Thanks for your question @idiot,

I’d recommend to set the values as comma-separated string instead.
You can configure a util bean in case you are using Spring with name e.g. “modelUtil” and implement the String toCsv(List) List<String> ofCsv(String csv) there.
Then use modelUtil.toCsv(), modelUtil.ofCsv() in expressions where needed.