How to get all (current) completed tasks in CMMN-processinstance?

Hello,

i need for every task, stage and caseplan model the current status. With a CaseExecutionquery-object, i get this for tasks, which are in status available, enabled, active, etc… by using:

List caseExceutions = engine.getCaseService()
.createCaseExecutionQuery()
.caseInstanceId(caseInstanceId).active() /enabled()/available()
.list();

but not in status completed. What would be the most efficent way to get the tasks /stages, which are currently in status completed?

Thanks a lot for your help!

Hi Andy,

you have to use the HistoryService to get completed CaseExecutions because they are no longer part of the runtime when they are completed.
HistoryLevel must be ACTIVITY or heigher.

See https://docs.camunda.org/manual/7.5/user-guide/process-engine/history/ for more information.

Best regards,

Markus