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.

https://cawemo.com/share/f4e8c12f-7531-4a31-a69f-65bb0c31fde2

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!