How to get logged in username in RTC using 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?