How to get list of process instance with their current status

I am assuming each process instance from a process definition is a task and I want a list of tasks with their current status.

Hi, This is what I’m currently using, although I’m fairly new to Flowable : Also, I’m using Spring Boot to host/integrate the Flowable Engine. The following are the Spring beans that are @Autowired in my main controller :

private ProcessEngine       processEngine;

private RepositoryService   repositoryService;

private RuntimeService      runtimeService;

private TaskService         taskService;

Process Definitions List :

    List<ProcessDefinition>     ltheItems = null;
    if ( getRepositoryService() != null ) { 
        ltheItems = getRepositoryService().createProcessDefinitionQuery().list();

Process instances List : (for a single ProcessDefinition)

    ProcessDefinition   ltheProcess = getProcessDefinition (theProcessId);
    if ( ltheProcess != null ) {
        ProcessInstance lprocessInstance = getRuntimeService().startProcessInstanceById ( theProcessId );

Task List :

    List<Task>              ltheItems = null;
    if ( getTaskService() != null ) { 
        ltheItems = getTaskService().createTaskQuery ().list ();

hth,

adym

1 Like

I would rely on executions when I want to get process instance state.
runtimeService.createExecutionQuery().processInstanceId(…)…

In that case you can get all wait states (e.g. intermediate catch events)

Regards
Martin

2 Likes