cancel
Showing results for 
Search instead for 
Did you mean: 

How to read taskEntity Id from service task(Espicially in parallel flow)?

swamy2156
Champ on-the-rise
Champ on-the-rise
Hi.,

In my workflow at some point, there is a parallel flow. Each leg, userTask will be created and using boundery timer on each task, firing a service task to send mail notification with taskId. I can see there is an api call to get taskIds from execution as follows.
List<Task> tasks = taskService.createTaskQuery().processInstanceId(processInstanceId).active().list();

But, its a parallel flow and each task has its own service task and hence 2 notifications for each task and in total 4 notification mails getting fired. Is there a way to know the taskId of current execution?


regards,
Swamy.



4 REPLIES 4

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

each service task can have different query. Let's say there is user task A (id="A")(with service task mailA) and in the parallel branch user task B ( with service task mailB)

in service task mailA use

Task taskA = taskService.createTaskQuery().processInstanceId(processInstanceId).taskDefinitionKey("A").active().singleResult();

(similar for service task mailB)
Regards
Martin

Yeah.. Thank you… You make my day Martin.

rhiremat
Champ in-the-making
Champ in-the-making
Is there any difference in below :

Task taskA = taskService.createTaskQuery().processInstanceId(processInstanceId).taskDefinitionKey("A").active().singleResult();

Task taskA = taskService.createTaskQuery().processInstanceId(processInstanceId).activityId("A").active().singleResult();

-Raj

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Raj,

there is.
taskDefinitionKey("A") - limits the query to return all tasks with id from process definition (there can be several tasks with the same definitionKey)

activityId("A") -Is it possible to specify activityId on the TaskQuery?

Regards
Martin
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.