Hi Ailin,
I tried recreating your scenario but this piece of code works fine with a team containing a user and a group created through Process Admin consisting one user.
I am not too sure about your configuration, it would be helpful to identify the issue if you can provide -
1. Full error log including the line number where the error is occurring
2. Setup of the team, meaning the construction of the team
My snippet (its exact same)
tw.local.filteredTeam = new tw.object.Team();
tw.local.filteredTeam.name = tw.local.originalTeam.name;
tw.local.filteredTeam.managerTeam = tw.local.originalTeam.managerTeam;
tw.local.filteredTeam.members = new tw.object.listOf.String();
for (var i = 0; i < tw.local.originalTeam.members.listLength; i++) {
if (tw.system.org.findRoleByName(tw.local.originalTeam.members[i])) {
var tempTeam = tw.system.org.findRoleByName(tw.local.originalTeam.members[i]).users;
for (var j = 0; j < tempTeam.length; j++) {
if (tempTeam[j].name != tw.local.hrAdmin1) {
tw.local.filteredTeam.members[tw.local.filteredTeam.members.listLength] = tempTeam[j].name;
}
}
} else{
if(tw.local.originalTeam.members[i] != tw.local.hrAdmin1){
tw.local.filteredTeam.members[tw.local.filteredTeam.members.listLength] = tw.local.originalTeam.members[i].toString();
}
}
}
------------------------------
Atanu Roy
Solution Architect
Salient Process
------------------------------