Skip to main content
11-Garnet
October 21, 2025
Solved

is there api to add multiple user to a role

  • October 21, 2025
  • 3 replies
  • 531 views

Is there a api which lets us add multiple users to single role. 

Best answer by SB_10904295

I used this method and it works.

team.addPrincipals(HashMap map);

3 replies

Catalina
Community Moderator
October 21, 2025

Hi @SB_10904295 

 

Thank you for your question! 

 

I’d like to recommend to bring more details and context to your initial inquiry. For example:

  • What version of product you're using?

Please add screenshot(s) to better understand what you are trying to do in your process. 

 

Please refer to this guideline to make your questions more likely to receive a quick and useful answer. 

This will increase your chances to receive meaningful help from other Community members. 

 

Here's what a good question for Windchill  looks like. 

 

Thank you for your participation and please let me know if you need further assistance! 

 

Best regards,

Catalina | PTC Community Moderator
Fadel
23-Emerald I
October 21, 2025

some inspiration can be found below 

https://www.ptc.com/en/support/article/CS355528 

Buiꓘa
HelesicPetr
22-Sapphire II
22-Sapphire II
October 21, 2025

Hi @SB_10904295 

Try to check following class and method.

https://www.ptc.com/en/support/article/CS138084

 

I guess that you have to use while/for loop to add more users.

or you can try following method but I've never use it. 

addRolePrincipalMap(HashMap var1, WTRoleHolder2 var2)

 

PetrH

PetrH
SB_1090429511-GarnetAuthorAnswer
11-Garnet
October 23, 2025

I used this method and it works.

team.addPrincipals(HashMap map);

HelesicPetr
22-Sapphire II
22-Sapphire II
October 23, 2025

Hi @SB_10904295 

Can you explain what values do you use in the HasMap input please? it would be useful for others. 

Thank you

PetrH 

PetrH