It's all about the answers!

Ask a question

Programmatically retrieve team area by user Id

Andrea Ianni (1611916) | asked Oct 13 '11, 10:29 a.m.
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:

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?


ps. I use RTC

Be the first one to answer this question!

Register or to post your answer.