How to get previous task id

Hi Team,
BPM modeler process used Jmix screen. How we can get previous task if we know current task?
In code, we are trying :
String previousTaskId = processFormContext.getTask().getParentTaskId();
But “previousTaskId” always is “null”.
Please help us!
Thank you!


The getParentTaskId() doesn’t return previous task. What you may do is to get the BpmnModel (which is a java representation of the process XML) and try to evaluate “previous” element there by analyzing incoming or outgoing connection of your FlowElement. You may get the BpmnModel using the repositoryService.getBpmnModel(processDefinitionId) method. Alternatively you may get the process XML and parse it: repositoryService.getProcessModel(processDefinitionId)