How to use javascript API to get all the users' ID/accounts in an role by the role name?
Accepted answer
In RTC 3.x and RTC 4.x at least, it is not possible to access users and roles and the like from JavaScript. See https://jazz.net/wiki/bin/view/Main/AttributeCustomization for what is doable and also https://jazz.net/library/article/1093
2 other answers
Today, there is no way I would be aware of to get to that information in JavaScript. You can only access the contributor type attributes and get an UUID and the user name. Given a UUID you can set users in scripts too. However, there is no JavaScript API to access the project area and its data.
You would have to use the built in providers Lauren mentioned above. If that is not feasible this workshop will publish some more labs on JavaScript in January. It will however not publish anything on your specific request.
You can look if this approach http://jorgediazblog.wordpress.com/2012/06/27/work-item-customization-httpconector-and-oauth-in-rtc-4-0-for-oslc/ has a way to provide you with the information you need. I am not sure and rather pessimistic.
If it is impossible to get at the information you want you should consider to follow this blog and create a followup action instead.
You would have to use the built in providers Lauren mentioned above. If that is not feasible this workshop will publish some more labs on JavaScript in January. It will however not publish anything on your specific request.
You can look if this approach http://jorgediazblog.wordpress.com/2012/06/27/work-item-customization-httpconector-and-oauth-in-rtc-4-0-for-oslc/ has a way to provide you with the information you need. I am not sure and rather pessimistic.
If it is impossible to get at the information you want you should consider to follow this blog and create a followup action instead.
Hi,
I'm not sure how to get all of the users of a given role using javascript. Depending on what you're trying to do, using Role Based User Lists may work for you: https://jazz.net/help-dev/clm/index.jsp?topic=%2F%2Fcom.ibm.team.workitem.doc%2Ftopics%2Ft_configuring_role_based_user_list.html.
I'm not sure how to get all of the users of a given role using javascript. Depending on what you're trying to do, using Role Based User Lists may work for you: https://jazz.net/help-dev/clm/index.jsp?topic=%2F%2Fcom.ibm.team.workitem.doc%2Ftopics%2Ft_configuring_role_based_user_list.html.
Comments
Hi,
I have created a "Role Based User List" value set "tester", but how to get the members of it?
For example, there is an attribute/field "tester" to use the value set, the options/list items in the UI are all the members in the role "tester", I can see all the members in the UI, but I want to know if there is a way to get the options by using javascript?
Hi Albert,
please check https://jazz.net/library/article/1093 Lab 4 talks about this.
Hi Ralph,
I do have the similar problem. I didnt find any information related to javacode in the above linked article.
"If it is impossible to get at the information you want you should consider to follow this blog and create a followup action instead."
The article above shows Client API but you should be able to use the complementary server API for the same purpose. The trick is to find the service. It typically has a similar name, that can help.
And this Participant (FollowUp Action) http://rsjazz.wordpress.com/2012/11/30/a-create-approval-work-item-save-participant/ finds an Approver using Roles. The API used is server API and should help you to get a grip at finding roles similar to the other blog post.
Comments
Albert Yao
Dec 28 '12, 1:35 a.m.I find this: https://jazz.net/forum/questions/65978/solved-get-users-with-a-role-on-a-teamarea,but this is for Java API, not for javascript.