Getting empty array while doing taskquery

Hello everyone,
The following returns an empty array.

taskService.createTaskQuery().processInstanceId(processInstanceId).active().list();

I checked the processInstanceId. It was correct but still got empty array. I checked the cockpit. It contains process instances with same id as processInstanceId. Then why it’s still returning an empty array? PLese help. Thank you.

Hi @Arnab_Paul_Joy,

This query should return running user tasks for the specified process instance.
Do you have any pending user tasks for the specified process instance? If you don’t then an empty array to be returned. (Notice:
active() means not suspended which I assumed is the case)

Yes, I have pending user tasks and I checked it using the following GET API call engine-rest/task/?processInstanceId={{processInstanceId}}.