It's all about the answers!

Ask a question

How to get logged in username in RTC using script?


Asha Faldu (1110) | asked Sep 02 '16, 3:07 a.m.
 I am trying to find out the logged in username using script in RTC. For that I have used below script.

dojo.provide("com.example.IssueSubmitterNameTestValueProvider");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("com.ibm.team.repository.web.client.session.Session");
(function() {               
              var getAuthenticatedContributor = com.ibm.team.repository.web.client.session.getAuthenticatedContributor;
            var loggedInUser = getAuthenticatedContributor().name;

 console.log("user :" +loggedInUser);

    dojo.declare("com.example.IssueSubmitterNameTestValueProvider", null, {

        getValue: function(attribute, workItem, configuration) {     

var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
            var state = workItem.getLabel(WorkItemAttributes.STATE);     

return loggedInUser;
        }
      
    });

})();

 

The Highlighed code is working fine If I write before declare statement. It gives the Username in console. If I write the same code after  getValue: function(attribute, workItem, configuration)  then it is not working.

Is there any error in code?

One answer



permanent link
Dinesh Kumar B (4.1k413) | answered Sep 02 '16, 3:41 a.m.
JAZZ DEVELOPER
this following post might help you :
https://jazz.net/forum/questions/133477/work-item-customization-getting-current-user-as-logged-in-user


Comments
Asha Faldu commented Sep 02 '16, 4:01 a.m.

 I used that code. It gives the logged in user name if i write that code before dojo.declare statement. if i write that code after dojo.declare statement than it is not working. 

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.