cancel
Showing results for 
Search instead for 
Did you mean: 

Process instance query problem

michael_nepyjwo
Champ in-the-making
Champ in-the-making
Hello,

I think I'm having an issue with the runtime service and a process instance query:
the query code is :

return runtimeService.createProcessInstanceQuery().processDefinitionId(processDefinition.getId())
                .orderByProcessInstanceId().asc().list();
}


-processDefinition.getId() is defined and exists in the database.
-a matching process instance exists in the database and the runtime service should return a list with this process instance but it returns an empty list…

Thanks for your answer.

Best regards,

Michaël Nepyjwoda

PS: I can provide screenshots of the code and the database if it helps you but you will have to tell me how to post them.
6 REPLIES 6

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Michaël,

Try to debug your code and
on the line

return runtimeService.createProcessInstanceQuery().processDefinitionId(processDefinition.getId())
.orderByProcessInstanceId().asc().list();
try to execute runtimeService.createProcessInstanceQuery().list() - you will see all process instances in the engine.
Check whether key is not misused as Id.

Regards
Martin

michael_nepyjwo
Champ in-the-making
Champ in-the-making
Hello Martin,

I've just tried what you suggested but the runtime service returns an empty list while some process instances are defined in the ACT_HI_PROCINST table…

Some other idea ?

jbarrez
Star Contributor
Star Contributor
- The runtime service will NOT return process instances from ACT_HI_PROCINST, but from ACT_RU_EXECUTION.

- Does runtimeService.createProcessInstanceQuery().list() give you anything?

michael_nepyjwo
Champ in-the-making
Champ in-the-making
Hi Joram,

runtimeService.createProcessInstanceQuery().list() returns an empty list and ACT_RU_EXECUTION is empty.

michael_nepyjwo
Champ in-the-making
Champ in-the-making
Joram,

I found what was wrong: the runtime service only returns active process instances and mine were finished.
So there is no more problem.

Have I something to do to close this post ?

Thanks.

jbarrez
Star Contributor
Star Contributor
Ok, good to hear. No need to close post, replying it's working is enough 🙂