How to get all possible flows from current activity?


I used code to get all flows from current activity described here
In Flowable v6.3.1 interface changed and I don’t know how to get it.

I know that:

Process process = ...?...
Activity activity = (Activity) process.getFlowElement(activityId, true);
List<SequenceFlow> outgoingFlows = activity.getOutgoingFlows();

but how can I get Process object?

public class GetOutgoingFlowsCommand implements Command<List<String>>, Serializable {

private String processDefinitionId;
private String activityId;

public GetOutgoingFlowsCommand(String processDefinitionId, String activityId) {
    this.processDefinitionId = processDefinitionId;
    this.activityId = activityId;

public List<String> execute(CommandContext commandContext) {
    List<String> possibleSequenceFlowIds = new ArrayList<String>();
    Process process = ProcessDefinitionUtil.getProcess(processDefinitionId);
    Activity activity = (Activity) process.getFlowElement(activityId, true);

    for (SequenceFlow sequenceFlow : activity.getOutgoingFlows()) {

    return possibleSequenceFlowIds;



@Jakub_Ferschmann this looks quite complex.

Have you looked at RepositoryService#getBpmnModel(String)? This returns you back BpmnModel and then you can do BpmnModel#getMainProcess()


How to fetch Extension elements on TaskListener.notify()

public class MyTaskCreateListener implements TaskListener {

public void notify(DelegateTask delegateTask) {
	Map<String, List<ExtensionElement>> exelements  = ProcessDefinitionUtil.getBpmnModel(delegateTask.getProcessDefinitionId()).getFlowElement(delegateTask.getTaskDefinitionKey()).getExtensionElements();


Is this the way or do we have any better way


I would not use the ProcessDefinitionUtil that’s an internal API. You can use the RepositoryService#getBpmnModel from the API package to get the BpmnModel



I believe we need to give the class names of the listener at extensionElements. In my case MyTaskCreateListener does not have any access to Repository Service. From the context of MyTaskCreateListener how can we get access to RepositoryServerObject,


@ksv have a look at the CommandContextUtil from the flowable-engine, you can get access to the RepositoryService through it