Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Im using windchill 10.1 M030, We have written a code for creating project automatically based on the lifecycle state of the document. When the document is released, the project will be created by the listener. Now the users are added manually in the respective roles in the project. Instead i wanted to add a particular members of a role from library as a project manager in the project context. Need help with this.
Solved! Go to Solution.
Hi all,
I have found the solution. below is the code snippet for achieving this
ContainerTeam libteam = ContainerTeamHelper.service.getContainerTeam((ContainerTeamManaged) pif.getContainer()); (pif is the WTDoc object)
HashMap map = libteam.getAllMembers();
Set keys = map.keySet();
Iterator itr = keys.iterator();
WTPrincipalReference UserName;
Object Role1;
Role ppeRole=null;
while(itr.hasNext())
{
UserName = (WTPrincipalReference)itr.next();
Role1 = map.get(UserName);
if(Role1.toString().contains("PDE PLANNING ENGINEER")) (custom role where the users are retrieved)
{
System.out.println(UserName.getName() + "-----------------" +Role1);
ContainerTeamHelper.service.addMember(localContainerTeam, ppeRole.toRole("PROJECT MANAGER"),UserName.getPrincipal() ); (retreived users are added in the role of Project Manager)
}
Hi all,
I have found the solution. below is the code snippet for achieving this
ContainerTeam libteam = ContainerTeamHelper.service.getContainerTeam((ContainerTeamManaged) pif.getContainer()); (pif is the WTDoc object)
HashMap map = libteam.getAllMembers();
Set keys = map.keySet();
Iterator itr = keys.iterator();
WTPrincipalReference UserName;
Object Role1;
Role ppeRole=null;
while(itr.hasNext())
{
UserName = (WTPrincipalReference)itr.next();
Role1 = map.get(UserName);
if(Role1.toString().contains("PDE PLANNING ENGINEER")) (custom role where the users are retrieved)
{
System.out.println(UserName.getName() + "-----------------" +Role1);
ContainerTeamHelper.service.addMember(localContainerTeam, ppeRole.toRole("PROJECT MANAGER"),UserName.getPrincipal() ); (retreived users are added in the role of Project Manager)
}