简体   繁体   中英

How to assign alfresco activiti workflow task to intersection of two or more groups?

I'm developing alfresco activiti workflow and i want to assign a task to users who simultaneously are in two specific groups. Separating groups by comma in activiti:candidateGroups gives the union of groups. Is it even possible to resolve this problem?

First you need to setup some service task / or some execution listener before getting to your user task to assign to your set of users, and there you should be using this and this to fetch your groups and their underlying users.

var group1 = people.getGroup("GROUP_DUMMY");
var g1Users = [];
if(group1){
   g1Users = g1Users.concat(people.getMembers(group1));         
}

var group2 = people.getGroup("GROUP_SAMPLE");
var g2Users = [];
if(group2){
   g2Users = g2Users.concat(people.getMembers(group2));         
}

Once you do so, you should setup a new array to contain only users that belong to both groups, but instead of putting the user nodes, you should be putting user.properties.userName instead.

You must have a String array with each and every value representing a username !

And finally export that array to your execution like this execution.setVariable('scwf_candidates', users); setup your user task like this:

<userTask id="..." name="My Task" activiti:candidateUsers="${scwf_candidates}">
</userTask>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM