cancel
Showing results for 
Search instead for 
Did you mean: 

Restrictions on candidate users

shr
Champ in-the-making
Champ in-the-making
Hello,

for a "Review document" workflow I have the requirement that a task shall not be claimed by the author of the document even if he/she is in candidateGroups. Assume the author's name is stored in a process variable. I guess it is possible to do so programmatically (Script task, or service call via JUEL?) but I am wondering if there is a better (declarative) way.

How would you model this restriction? Your input is much apprechiated.

Regards,
Stefan
6 REPLIES 6

jbarrez
Star Contributor
Star Contributor
That's a tricky requirement … even with scripts/expression it would be hard to do since the candidate group is in there.
The way I see it, it must be done in a layer above Activiti, and it needs to be filtered out there.

shr
Champ in-the-making
Champ in-the-making
Thanks for your assessment. So you are suggesting to feed a list of the eligible users to Activiti's candidateUsers? candidateUsers seems to accept JUEL expressions, so I'll have a look into these.

jbarrez
Star Contributor
Star Contributor
No, the problem is that the query will always use the candidategroups.

I think you need to write custom logic around this query that filters out the response when the owner fetches the task list

shr
Champ in-the-making
Champ in-the-making
I think we have a misunderstanding here. Let me elaborate: Instead of [php]candidateGroup="reviewers"[/php] I was going to try something along the lines of [php]candidateUsers="${util.allExcept(reviewers, author)}"[/php]. The method would then query for tasks like [php]taskService.createTaskQuery().active().taskCandidateGroup(reviewers).list()[/php] and additionally filter the author from the list. Maybe that is also what you are suggesting. There are probably more ways how and where to apply the filtering, but this is the one solution I can think of at the moment.

jbarrez
Star Contributor
Star Contributor
Yes, we're talking about the same thing, but you're solution is probably better. You can indeed use a custom bean in those expressions to do what you need.

shr
Champ in-the-making
Champ in-the-making
Cool. Thanks for sharing your perspective.