Skip to main content
Oct 21, 2025 10:40 AM UTC
Solved

is there api to add multiple user to a role

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

Oct 23, 2025 4:29 AM UTC

I used this method and it works.

team.addPrincipals(HashMap map);

5 replies

Community Manager
Oct 21, 2025 1:35 PM UTC

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,

3-Newcomer
Oct 21, 2025 2:57 PM UTC

some inspiration can be found below 

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

Oct 21, 2025 3:15 PM UTC

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

SB_10904295AuthorAnswer
Oct 23, 2025 4:29 AM UTC

I used this method and it works.

team.addPrincipals(HashMap map);

Oct 23, 2025 5:53 AM UTC

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