It's all about the answers!

Ask a question

How to set enumeration selected value to a long type attribute by using dojoscript in a workitem


Pavan M (393) | asked Dec 16 '21, 6:22 a.m.

 Hii,


I need to know how to set an enumeriation selected value to a long type attribute in a Workitem. I had a enumeration attribute with values 1.1, 1.2, 1.3, If I selects 1.1 then it need to update in the long type custom attribute I need to know is it possible because I tried the below coad but not working.

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

(function() {
    var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes; 

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

        getValue: function(attribute, workItem, configuration) {
            var prio1 = workItem.getValue("testd"); 
     
             console.log("prio3"+ prio1);          
            return prio3;
        }
    });
})();

Please help me in this.

Thank you,

Regards,
Pavan.

One answer



permanent link
Ralph Schoon (63.1k33646) | answered Dec 16 '21, 7:14 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Dec 16 '21, 7:16 a.m.

 You can use a calculated value for this kind of stuff. The script above is not going to return anything as it tries to return an undefined value. 



I would suggest to look up the "Process Enactment Workshop" in the menu item Library above, and go through the last two labs. That should provide you with what you need. console.log is not necessary, you can debug the scripts.

https://jazz.net/wiki/bin/view/Main/AttributeCustomization explains the API. E.g. for enumerations you get literals as value - which are represented as literal identifier or as display value, dependent if you use getValue() or getLabel(). 

There are nice JavaScript tutorials one google hop away that explain how to create numbers from strings.

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.