1 Reply Latest reply on Aug 31, 2010 9:21 AM by swd_eagle

    Issue retrieving task comments

    swd_eagle

      Hi all,

       

      I have a process which enables users to make comments to tasks during various steps in the workflow.


      At some point, I need to be able to view all the comments made. This 'point' is also within a task. What I have now is, assuming that taskId is the task in which the process finds itself when it needs to view the history comments:

       

      String executionId = processEngine.getTaskService().getTask(taskId).getExecutionId();

       

      Execution execution = processEngine.getExecutionService().findExecutionById(executionId);

       

      String processInstanceId = execution.getProcessInstance().getId();

       

      List<HistoryDetail> history = processEngine.getHistoryService().createHistoryDetailQuery()                                    

      .processInstanceId(processInstanceId).comments().orderDesc(HistoryDetailQuery.PROPERTY_TIME).list();

       

      This always returns an empty array, even though there are definitely comments made to previous steps in the workflow. I can verify that by examining the database. Trace code shows the processInstanceId to be what I expect it to be, but for some reason the History comments can't be retrieved.

       

      What's the correct way of doing it? Ie, getting all comments that was made on all tasks that were in the same process instance of a given task?

       

      Thanks!