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 (60.5k33643) | 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.