AnsweredAssumed Answered

Querying ProcessInstance on PROCESS_COMPLETED events

Question asked by ravenblackdusk on Apr 17, 2017
Latest reply on Apr 17, 2017 by ravenblackdusk

I'm trying to handle a PROCESS_COMPLETED event by creating an ActivityEventListener bean:

 

   @Override
    public void onEvent(ActivitiEvent event) {

         final ProcessInstance processInstance = event.getEngineServices().getRuntimeService()
                .createProcessInstanceQuery().processInstanceId(event.getProcessInstanceId())
                .includeProcessVariables().singleResult();

   }

 

first of all event.getProcessInstanceId() returns an id that does not exist in the database, second ProcessInsantceQuery seems to only return process instances that are not completed(hence processInstance == null). My goal is to get the variables of every process instance that is completed. how can I achieve this?

Outcomes