I’m having problems retrieving objects using process instance id.
I perform a GET request to get all process instances id’s that I ran, take one and try to use it for some operations, but they always fail because of one of these reasons:
1- the task returned by process instance id is null, or
2- the execution with specified process instance id does not exist
In detail, in the first case I’m doing this:
org.flowable.task.api.Task task = taskService.createTaskQuery().processInstanceId("e3ada504-5ba5-11e9-ac0e-d46d6dbfea92").singleResult(); System.out.println("Task information " + task.getCategory() + " - " + task.getName() + " - " + task.getClass() + " - " + task.getScopeType());
NullPointerException is thrown because task is null.
In the other case, I’m trying to get the map of variables but it throws an error:
execution <processInstanceId> doesn't exist
I’ve followed the test code on github and wrote:
Map <String, Object> pvar = new HashMap<String,Object>(); pvar.put("status",200); pi = runtimeService.startProcessInstanceById(processDefinitionId, pvar);
then I try to get the map again and
Map<String,Object> variables = runtimeService.getVariables(pi.getId());
and the error is thrown.
What am I missing? Why I can’t get the informations? What’s the correct way to use the processInstanceId?
This does not happen always. With some process instances it does work and do not throw
Nullpointerexception. I don’t get the reason why