cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Replace WTUser in a Project

Highlighted
Regular Member

Replace WTUser in a Project


Hello,

I am testing an expression, which replaces one user in a project with another user. This expression works great as long as both users are in the Organization.

The reason I am writing is that I need help getting the WTUser for a user that is not in the Organization. The expression below is an example of what I am trying to accomplish.


wt.inf.container.WTContainer cont = ((wt.inf.container.WTContained)primaryBusinessObject).getContainer();
wt.inf.team.ContainerTeam contTeam = wt.inf.team.ContainerTeamHelper.service.getContainerTeam( (wt.inf.team.ContainerTeamManaged)cont);
wt.inf.team.ContainerTeamReference contTeamRef = wt.inf.team.ContainerTeamReference.newContainerTeamReference(contTeam.getPersistInfo().getObjectIdentifier());

wt.org.WTUser replacedUser = null;
java.lang.String replacedUserName = "unassigned_research_engineer";
replacedUser = wt.org.OrganizationServicesHelper.manager.getAuthenticatedUser( replacedUserName.toLowerCase() );
wt.org.WTUser newUser = null;
java.lang.String newUserName= "dwilliams";
newUser = wt.org.OrganizationServicesHelper.manager.getAuthenticatedUser( newUserName.toLowerCase() );

wt.inf.team.ContainerTeamHelper.service.replaceUser( contTeamRef, replacedUser, newUser, true, true);
wt.inf.team.ContainerTeamHelper.service.recomputeMembership((wt.inf.team.ContainerTeamManaged) cont );


The unassigned_research_engineer is obviously a placeholder for dwilliams. This unassigned_research_engineer is not in the organization but can be pulled in a WTUser report. The issue I am seeing is that the "getAuthenticatedUser( replacedUserName.toLowerCase())" method returns an empty value.

Any suggestions?

Thank you for your time,
Dax
Announcements