finding the entire Task History Based on the processInstanceKey

Hi Team,

I’m facing a issue for finding the entier Task History Based on the processInstanceKey with custom Queries in camunda 8,

Below is my code snippet, Here when I claim/unclaim and change the assignee for a particular task’s User Tasks, I’m unable to get that claim/unclaim statuses of the Assigne in the Task History with the below Queries, kindly anyone address this issue and help in solving this.

I have tried to query in both Elastic Search and Task List as well but I’m facing the same issue

For Elastic Search:

	BoolQueryBuilder boolQuery = QueryBuilders.boolQuery()
    	.must(QueryBuilders.matchQuery("value.tenantId", tenantId))
        .must(QueryBuilders.matchQuery("value.processInstanceKey", executionId));

    SearchRequest searchRequest = new SearchRequest(Constants.JOB_RECORD_INDEX_KEY);
    SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
    searchSourceBuilder.query(boolQuery);
    searchSourceBuilder.size(Constants.RETRIVAL_SIZE); 
    searchRequest.source(searchSourceBuilder);
    SearchResponse searchResponse = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);

For Task List:

if (tasklistClient == null) {
	 try {
           tasklistClient(); 
       } catch (TaskListException e) {
           logger.error("Error initializing tasklist client", e);
           throw e; 
       }
   }
TaskSearch ts = new TaskSearch().setProcessInstanceKey(executionId);
TaskList tasksFromInstance = tasklistClient.getTasks(ts);
List<Task> tasks = tasksFromInstance.getItems();

Thank You in advance !

Hi @Eswar welcome to the Camunda forums.
Which version of Camunda 8 are you on?

Hi @panagiotis_goutis , I’m using camunda 8.5 self managed

There is no OOTB solution for the use case you are referring to. There are plans for including such a solution on later Camunda 8 releases.

In Camunda 8.5 Zeebe User Tasks were introduced. For Zeebe User Tasks, you can extract the required status changes from the zeebe-record-user-task index directly if you wish so.

The update intent (assign/unassing/complete) for the Zeebe User Tasks is being recorded there along with relevant metadata.

Hey @panagiotis_goutis Thank you for the valuable information , Generally user tasks consists of two types zeebe user task and jobWorker , but that index stores only tasks that are of type zeebe user task but not job worker , Like in my case we are using user task of jobWorker.

Hey @Eswar as noted in User Tasks documentation, there are some limitations to Job Workers. In general, Zeebe User Tasks provide more features OOTB, check out this guide to discover more about them.

Is it possible for you to use the new Zeebe User Tasks to achieve your goal?

Kind regars,
Panagiotis