cancel
Showing results for 
Search instead for 
Did you mean: 

getting a user's candidate tasks without the user's group tasks

frequentcrasher
Champ in-the-making
Champ in-the-making
Hi,

we have a system where reports can be submitted to a group for review which we set the candidate group to SUPERVISOR in the definition and we have reports that we send to specific people which we set the candidate user to jsmith01 for example. most of the time we just want everything a user is candidate for which the taskQuery.taskCandidateUser call seem to fetch but sometimes we want only the tasks for the group (which seems to be fulfilled by the taskQuery.taskCandidateGroup call) but I don't see anything for getting only the reports where the user is specifically set as the candidate user without getting everything else that's candidate for the group he's in. Any help is greatly appreciated.
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
No, the idea is that that query gives you all the tasks where you are a candidate for. But i see your point. Its fairly easy added into the query api too. What is the use case you have, why would you wanto distinguish?

frequentcrasher
Champ in-the-making
Champ in-the-making
We have a multi tier (3 tiers for example) report approval system where tier 1 can write reports and are passed on to tier 2 to approve and then passed on to tier 3 for approval. But tier 2 guys can also help write reports and their reports only go to tier 3 for approval. Reports sent to people for approval go to an inbox and stay there until they are claimed to be worked on and these would go to the candidate group. Reports you submit can also be rejected back to you if you did a lousy job writing it and these would go to candidate user. We don't use assigned because we want to distinguish reports between waiting to be worked on (unclaimed) and working on it (claimed). I think I am able to get around this by using a NativeTask query and joining the task table with the identity link table like this:

List<Task> nativeResult = taskService.createNativeTaskQuery().sql("select t.ID_, t.NAME_, t.PROC_INST_ID_, t.PROC_DEF_ID_, t.TASK_DEF_KEY_ from ACT_RU_TASK t INNER JOIN ACT_RU_IDENTITYLINK i on t.ID_ = i.TASK_ID_ where i.TYPE_ = 'candidate' AND i.USER_ID_ = '" + userId + "'").list();

Does this seem right to you? Obviously, an API call would be preferred so that I don't have to worry about missing out on internal logic or changing db structure breaking things. Any input would be greatly appreciated.

jbarrez
Star Contributor
Star Contributor
That looks a correct query yes.

You are always more than welcome to provide a pull request for this so it gets in the API 😉