Programmatically retrieve team area by user Id
Hi all,
I try to retrieve team area by work item creator userId for populate a new custom field.
I will use this new information to create a simple query that show me all defects opened by team area.
I try in this way but I hope that exist other simple way:
Moreover, the task have the Creator UserId value when it's just open or the creator is valorized only after a save action?
Thanks
Andrea
ps. I use RTC 2.0.0.2
I try to retrieve team area by work item creator userId for populate a new custom field.
I will use this new information to create a simple query that show me all defects opened by team area.
I try in this way but I hope that exist other simple way:
IContributorHandle creHandle = wi.getCreator();
IContributor creator = (IContributor)(repositoryItemService.fetchItem(creHandle, null));
List<ITeamAreaHandle> teamAreas = projectArea.getTeamAreas();
for (ITeamAreaHandle taHandle:teamAreas) {
ITeamArea ta = (ITeamArea) (repositoryItemService.fetchItem(taHandle, null));
IContributorHandle[] members = ta.getMembers();
for (IContributorHandle memberHandle : members) {
IContributor member = (IContributor) (repositoryItemService.fetchItem(memberHandle, null));
if ( member.getUserId() == creator.getUserId() ) {
//TODO add this value in custom field
}
}
}
Moreover, the task have the Creator UserId value when it's just open or the creator is valorized only after a save action?
Thanks
Andrea
ps. I use RTC 2.0.0.2