I have a groovy script that creates a map of tasks that I want to display within a user form:
Map<String,String> tasks = new HashMap<String,String>();
tasks.put("task 1","this is a new task");
tasks.put("task 2","this is another new task");
This is fine and allows me the ability to reference the tasks
variable throughout my process model. But how do I iterate through this map in the user form using JavaScript?
I thought I might be able to reference the tasks
variable within the user form in a Display text control like this:
All tasks: ${tasks}
But the tasks
variable is empty.
Im fairly new to Activiti so please excuse me if this a simple fix.
If you will return the Map as a JSON, It will be good to that read / parse in javascript.
Map<String,String> tasks = new HashMap<String,String>();
tasks["task 1"] = "this is a new task";
tasks["task 2"] = "this is another new task";
println tasks.dump()
// return / render the above map task to java script or you can return that as a JSON.
In javascript you can iterate the map elements and show, parse if it is rendered as a JSON.