It's all about the answers!

Ask a question

How can I get the user name of a contributor using JavaScript?


Ashwath G (6623851) | asked Jul 30 '15, 6:50 a.m.
edited Jul 30 '15, 7:05 a.m. by Ralph Schoon (63.2k33646)
Hello,

I am trying to read the owned by attribute using the script to increase the Re Assignment counter when ever a change on the owned by )Assigned by) value is changed. But the function returns me the internal_id of the user_id in the attribute where iam capturing the owned by attribute o/p.

If i would like to convert this internal_id to a string , what is the function to be used ?

Kindly help me out to resolve this issue.

**********************************************Code  Sample*******************************
dojo.provide("com.ibm.team.workitem.hiddenassignee");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
   dojo.declare("com.ibm.team.workitem.hiddenassignee", null,  {  

   getValue: function(attributeId, workItem, configuration) {
 
        var hiddenassignee = workItem.getValue(WorkItemAttributes.OWNER);

        console.log("hiddenassignee: assignee is "+hiddenassignee);   
         return hiddenassignee ;
    }
    });
    })();





Thank You..!

Ashwath

Accepted answer


permanent link
Ralph Schoon (63.2k33646) | answered Jul 30 '15, 7:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Jan 05 '16, 4:37 a.m.
Yes, for complex objects
  • getValue() returns the UUID - which could be used to set a complex item, if supported at all. 
  • getLabel() can be used to get the readable user name. Note that the user name can not be used to set anything.

Carefully read https://jazz.net/wiki/bin/view/Main/AttributeCustomization and
Lab 5
Ralph Schoon selected this answer as the correct answer

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.