Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to get logged in username in RTC using script?

 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?

0 votes



One answer

Permanent link
this following post might help you :
https://jazz.net/forum/questions/133477/work-item-customization-getting-current-user-as-logged-in-user

0 votes

Comments

 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 log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Sep 02 '16, 3:07 a.m.

Question was seen: 2,091 times

Last updated: Sep 02 '16, 4:01 a.m.

Confirmation Cancel Confirm