@Rayel here is a little snippet of code that might be relevant
String taskId = task().getTaskDefinitionKey()
UserTask userTask = modelUserTasks().getModelElementById(taskId)
Collection<FlowNode> sequenceFlows = userTask.getSucceedingNodes().filterByType(UserTask).list()
sequenceFlows.each {
println it.getName()
}
This is from a unit test. So task()
is just a helper that is returning the current task that the process is waiting on.
You get the task Def Id (the id value in the BPMN of the Task), and get the model element from the BpmnModelInstance. Then there is a helper method for doing a query on all flow nodes.
If you want to go further in the flow nodes then you will need to write a recursion loop i believe, to get each node on each subsequent activity. Looping in the BPMN is also likely a issue, where it would overflow (most likely)