how can i get current user
7 answers
i want customize attribute,how can i get current user(login this RTC user),please help me!thank you!
Depends on what you want to do in which version. In 3.x there is a capability to do "Attribute Customization" you can create a default value for a user attribute and select authenticated user to get the logged in user.
i want customize attribute,how can i get current user(login this RTC user),please help me!thank you!
Depends on what you want to do in which version. In 3.x there is a capability to do "Attribute Customization" you can create a default value for a user attribute and select authenticated user to get the logged in user.
Hello,
i use RTC in 3.0.1. I using scripts for attribute customization in work item to validate something. but i don't get current user in script. How can i to do it? What function can get curent user in script? Can you provide some API and some example ? Thank you!
The scripting capabilities are still experimental - that is why you need to enable them in the advanced properties. This is what can be done: https://jazz.net/wiki/bin/view/Main/AttributeCustomization
I have looked into accessing users in the scripting and it does not really work as far as I know. It returns user ID's and I was not really capable of doing anything with it. I don not think that you can access the current user using the scripts.
I have looked into accessing users in the scripting and it does not really work as far as I know. It returns user ID's and I was not really capable of doing anything with it. I don not think that you can access the current user using the scripts.
The scripting capabilities are still experimental - that is why you need to enable them in the advanced properties. This is what can be done: https://jazz.net/wiki/bin/view/Main/AttributeCustomization
I have looked into accessing users in the scripting and it does not really work as far as I know. It returns user ID's and I was not really capable of doing anything with it. I don not think that you can access the current user using the scripts.
I try create a default value for a user attribute eg:loginUser, and select authenticated user to get the logged in user,then I use "workitem.getValue(loginUser)" to get authenticated user ,but it return "null",why?
if I use Java not javascript to get current use,which API can I use,can you offer me some useful example? Thank you!
The default vale will only be set once and essentially sets the value to the creator of the work item, not the current user.
I would suggest to add your need here https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=169823. The current user would have to be exposed in the script UI.
Please read this topic completely and carefully: https://jazz.net/wiki/bin/view/Main/AttributeCustomization. It describes what can be done today using Java Script and how.
To read the attribute please follow the above link and try to add the dependent attribute into the configuration. That however will not help you for the reason above. In addition I experienced that the script API currently returns the user ID only and I found no way to use it for anything but printing the ID. I was even not able to set a contributor using the ID I retrieved.
You can also follow https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Providing_new_customizations_imp to implement your own attribute value provider. I have no example for it. Inthe Java API you can access the current user using
That is about all I know.
I would suggest to add your need here https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=169823. The current user would have to be exposed in the script UI.
Please read this topic completely and carefully: https://jazz.net/wiki/bin/view/Main/AttributeCustomization. It describes what can be done today using Java Script and how.
To read the attribute please follow the above link and try to add the dependent attribute into the configuration. That however will not help you for the reason above. In addition I experienced that the script API currently returns the user ID only and I found no way to use it for anything but printing the ID. I was even not able to set a contributor using the ID I retrieved.
You can also follow https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Providing_new_customizations_imp to implement your own attribute value provider. I have no example for it. Inthe Java API you can access the current user using
IContributor loggedIn = TeamRepository.loggedInContributor();
That is about all I know.
Hello rschoon:
value content="${currentUser}
I set a attribute's default value is about it.This attribute display the current user,not the creator of the work item.but I use "workItem.getValue(attributeId)" to get about attribute value,it return null.
You said :
this mean you can return current use name ID,I currently need the current use name ID ,how can I get ID?
Thank you!
value content="${currentUser}
I set a attribute's default value is about it.This attribute display the current user,not the creator of the work item.but I use "workItem.getValue(attributeId)" to get about attribute value,it return null.
You said :
In addition I experienced that the script API currently returns the user ID only and I found no way to use it for anything but printing the ID. I was even not able to set a contributor using the ID I retrieved.
this mean you can return current use name ID,I currently need the current use name ID ,how can I get ID?
Thank you!