I have been trying to display service tasks (both completed or not) together with their process variables on a custom UI but i am not getting any results. I looked every where but i am not seeing which api or method to use to complete this.
Has anyone achieved this ?
Hi @nicholaschun and welcome to the forum.
What kind of service task do you actually mean?
If you’re referring to external tasks, then you can use the method createExternalTaskQuery() in the ExternalTaskService to search for existing external tasks.
If the service task was not yet activated (token didn’t yet reach the task in the process instance), there’s no easy way to query for those. You would actually not know, if they would ever be reached.
If you want to search for already completed service tasks, you have to use the HistoryService. There you can use the createHistoricActivityInstanceQuery method to search for historic activity instances. You could restrict the search to those with activityType “serviceTask”, to only get the completed service tasks.