javaactiviti

can i set a Activiti user task to multiple candidate groups?


Normally I set the Activiti user task to a assignee, candidate users or a candidate group. I'm wondering if I can set multiple candidate groups not just a candidate group like :

group1, group2

Solution

  • You can use DelegateTask to add multiple groups as candidate group, with method: addCandidateGroups

    example:

        @Component("CustomTaskListener")
        public class CustomTaskListener implements TaskListener {
        
            @Override
            public void notify(DelegateTask task) {
                
                List<String> groups = new ArrayList<>();
                groups.add("group1");
                groups.add("group2");
                
                task.addCandidateGroups(groups);
            }
        }