TWsearch API Script :
var index = 1;
var team1= tw.system.org.findTeamByName("CBE");
for (var i = 0; i < team1.allUsers.length;i++){
tw.local.pGroup1[i]=team1.allUsers[i].name;
}
var team2= tw.system.org.findTeamByName("CHE");
for (var i = 0; i < team2.allUsers.length;i++){
tw.local.pGroup2[i]=team2.allUsers[i].name;
}
var index = 0;
for (var i = 0; i < team1.allUsers.length;i++){
var usermatch = team1.allUsers[i].name;
for (var j = 0; j < team2.allUsers.length;j++){
if(usermatch == team2.allUsers[j].name){
tw.local.usermatch[index] = usermatch;
index++;
}
}
}
Result : tw.local.usermatch list will have the users who are belongs to two different groups.
var index = 1;
var team1= tw.system.org.findTeamByName("CBE");
for (var i = 0; i < team1.allUsers.length;i++){
tw.local.pGroup1[i]=team1.allUsers[i].name;
}
var team2= tw.system.org.findTeamByName("CHE");
for (var i = 0; i < team2.allUsers.length;i++){
tw.local.pGroup2[i]=team2.allUsers[i].name;
}
var index = 0;
for (var i = 0; i < team1.allUsers.length;i++){
var usermatch = team1.allUsers[i].name;
for (var j = 0; j < team2.allUsers.length;j++){
if(usermatch == team2.allUsers[j].name){
tw.local.usermatch[index] = usermatch;
index++;
}
}
}
Result : tw.local.usermatch list will have the users who are belongs to two different groups.