I am using Activiti 7.1.24 in Spring boot for workflow controls
when a process instance is started, I would like to check all the tasks defined in BPMN file. below is the code I used to list them.
taskService.createTaskQuery().processInstanceId(processInstanceId).list();
unfortunately, the list method return only the first task of the process instance.
my question is, how to get other tasks from query, did I do anything incorrectly? if not how can I get all the tasks?
Thanks
tasks defined in BPMN file
A task is either a currently pending task waiting for completion right now, or (in case of a historic task) something that has been completed in the past. You seem to ask about finding user tasks that haven't happened yet, therefore you have to go find this information from a BPMN model. Start from here
@Autowired RuntimeService runtimeService;
@Autowired RepositoryService repositoryService;
....
var proc = runtimeService.createProcessInstanceQuery()
.processInstanceId(processInstanceId)
.singleResult();
var model = repositoryService.getBpmnModel(proc.getProcessDefinitionId());
var elements = model.getProcesses().get(0).getFlowElements();
// iterate and search for UserTask