Task History service not returning service task

Hi Community,

I want to fetch a count of service tasks and check how many times a service task got executed in a particular time window? I am using a history service for the same. Please see code below:

List countByTaskName = historyService.createHistoricTaskInstanceReport() .completedAfter(date).countByTaskName();

While iterating the list of HistoricTaskInstanceReportResult, the service task is not found in list. So I cannot get a count of it.


If we consider this process, I am not getting the Task3 in HistoricTaskInstanceReportResult list.
Can you please help?

Thanks in advance!

Hi @chakravyooh - the method createHistoricTaskInstanceReport() is specific to user tasks. It looks like, per your diagram, Task3 is a service task, so you would likely need to use the historyService.createHistoricActivityStatisticsQuery() or historyService.createHistoricActivityInstanceQuery() method.

Thanks @jwarren!