Mr Barrey told this "Why would you want that? [update a process variable] It would screw the transaction going on at that time"
Why do we do to avoid that ? Is there a workaround ?
In my case I have a subprocess because several people have to accomplish a task . I created a List of string to include people Id and to inject in a process
Actually, when process is started and before subprocess, I have to check if any other people have to accomplish a task in subprocess or not (because between the beginning of the whole process and the subproccess call , it exist a while of 14 days.)
Map<String, Object> variableMap = new HashMap<String, Object>(); variableMap.put("peopleForSubprocess", people); Processstart….
BUT when process is started , if a person is detected to accomplish the subprocess, we have to update the variable : List<String> people = (List<String>) runtimeService.getVariable(processId, "peopleForSubprocess");
String sup4 = "id4"; people .add(sup4 );
runtimeService.setVariable(task.getExecutionId(), "peopleForSubprocess", people );
Can we do that ? Or is it better to create a new variable ? (but it seems impossible because , a subprocess can get only one collection)
I would say, that you can update variable in the subprocess without any concerns. org.activiti.engine.test.bpmn.subprocess.SubProcessTest#testDataObjectScope