It's all about the answers!

Ask a question

Is it possible to use Script Based Value set Javascript to add users into Contributor attribute?


Don Yang (7.7k21114139) | asked Dec 01 '16, 7:32 p.m.
edited Dec 01 '16, 8:46 p.m.
In RTC6.0.2 ifix06a, the user is trying to add some users into contributor attribute via script based value set javascript.
Here is something we tried:

dojo.provide("com.ibm.test");


(function() {
dojo.declare("com.ibm.test", null, {

    getValueSet: function(attributeId, workItem, configuration) {
    var result= [];
      
    result.push("__4EYkLeGEeaQcv186zNgDQ");
        result.push("_tqJsELeFEeaQcv186zNgDQ");
        return result;
    }
});
})();


Those UUIDs are from browsing the user in web client such as
/ccm/admin#action=com.ibm.team.repository.editUser&itemId=__4EYkLeGEeaQcv186zNgDQ

Then creating a custom contributor attribute and use this javascript value set. When creating a workitem, there is no users added into the contributor attribute at all(it shows Unassigned and more only)

From Forum discussion, it seems retrieving a contributor UUID is possible, I tried to retrieve creator UUID and then set it to custom contributor but still see nothing((it shows Unassigned and more only)

dojo.provide("com.ibm.test");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {
  var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.ibm.test", null, {

    getValueSet: function(attributeId, workItem, configuration) {
        var creatorID = workItem.getValue(WorkItemAttributes.CREATOR)
    var result= [];
        result.push(creatorID);
    //result.push("__4EYkLeGEeaQcv186zNgDQ");
        //result.push("_tqJsELeFEeaQcv186zNgDQ");
        return result;
    }
});
})();


I am wondering whether it is possible to add users to contributor attribute using javascript.

The main requirement here is to list the contributor dependent on another attribute selection. This is similar to the features discussed in https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Dependent_Enumerations_3_0_1
but I don't see contributor is supported there, only enumeration type seems to be supported.
Appreciate if anyone can shed some lights on this.

Accepted answer


permanent link
Don Yang (7.7k21114139) | answered Dec 02 '16, 1:05 a.m.
In my further test, I found that the added two users are listed in Web client. But in Eclipse client, it shows Unassigned with More.. option. I think the user can add whatever users through More.. option in both web and eclipse clients, hence the end result is the same.
So if we want to limit the selection option in the custom contributor attribute, I have to change attribute kind to Generic Combo(instead of Contributor) in editor presentation. That gives me the list of the added users in both Eclipse and Web clients.
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.