Does anyone have an answer for this one? I'm facing the same problem. The documentation says getTasks "Returns all the task instances associated with this workflow path. " However, it only returns the currently active one. Please help!
In order to get all the tasks related to particular workflow you can use Workflow task query class. WorkflowTaskQuery query = new WorkflowTaskQuery(); query.setActive(null); query.setProcessId(wi.id); query.setTaskState(WorkflowTaskState.COMPLETED); query.setOrderBy(new WorkflowTaskQuery.OrderBy[] { WorkflowTaskQuery.OrderBy.TaskCreated_Desc, WorkflowTaskQuery.OrderBy.TaskActor_Asc }); List<WorkflowTask> tasks = Repository.getServiceRegistry(context). getWorkflowService().queryTasks(query);
NOTE: wi=workflow instance so wi.id=workflow id This will return you the all the tasks of workflow which are completed. then for getting tasks which are inprogress you need to again fire query with taskstate as INPROGRESS.