It's all about the answers!

Ask a question

How to get the current userID in a condiftion javascript


VERT Eric (1533) | asked Mar 15 '13, 5:49 p.m.
edited Mar 16 '13, 9:18 a.m. by Ralph Schoon (63.6k33646)
I need to put a field on readonly mode for some users is there someone to help me ?

4 answers



permanent link
Erwin Kunz (94687086) | answered Mar 18 '13, 4:25 a.m.
No idea about Java, but why not using preconditions which are build in



permanent link
Ralph Schoon (63.6k33646) | answered Mar 18 '13, 4:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
As far as I can tell, there is no way to access the user ID of the user that is currently logged in and working with the work item in JavaScript. See https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_for_Javascript for what is possible. From the same page, I would assume it would be possible to use the JavaAPI to create a condition. Although I have note yet tried that myself, I would assume that in the condition plugin you would be able to access the logged in user.

permanent link
Rogério Ramos da Silva (33512827) | answered Feb 14 '14, 8:40 a.m.
edited Feb 14 '14, 8:43 a.m.
Maybe can be helpful for someone trying to get the current user using JS API (dojo). I've solved this need like that:

var currentUser =      com.ibm.team.repository.web.client.session.getAuthenticatedContributor;


That var has a property called itemId which retrieves the user internal ID
like _JPlIwJMVEeOQyJhn3MD2hQ, such property can be compared with the value retrieved from an attribute 
like com.ibm.team.workitem.attribute.owner.
With this concept in mind, you can use the Attribute customizations and create a Condition Script used in cooperation with the built-in Advisor Read-Only Attributes For Condition.

permanent link
Ralph Schoon (63.6k33646) | answered May 21 '15, 4:02 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Please see answer https://jazz.net/forum/questions/133477/work-item-customization-getting-current-user-as-logged-in-user/184711 for how to get the item ID for the user that runs the operation. Thanks to Amaury Quintero for providing this info.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.