It's all about the answers!

Ask a question

Unable to copy RTC workitem description using javascript


Hareesh Jairaj (832238) | asked Jun 04 '15, 11:57 a.m.
Hi, 

 

I am trying to copy the RTC WI description value to a medium string / Html box using the script attached and it is not working.

 

dojo.provide("com.example.common.MyClass");

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

 

(function() {

dojo.declare("com.example.common.MyClass", null, {

 

    getDefaultValue: function(attributeId, workItem, configuration) {

     

        var value =  workItem.getValue(workItemAttributes.DESCRIPTION);

        return value;

   

    }

  

});

})();

       

The Same script is working between two custom attributes.

       

I tried replacing the description attribute id as wee, no luck !

       

Any help on this is much appreciated.

Accepted answer


permanent link
Don Yang (7.7k21114139) | answered Jun 05 '15, 12:30 a.m.

I created a calculated Value with the below script based on yours and set  it to a custom attribute: medium string or HTML and this works for me:

dojo.provide("com.example.common.MyClass");

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

    getValue: function(attributeId, workItem, configuration) {

        var value =  workItem.getValue(WorkItemAttributes.DESCRIPTION); 
   
         return value;

    }
});

})();

Hareesh Jairaj selected this answer as the correct answer

Comments
Hareesh Jairaj commented Jun 05 '15, 9:08 a.m.

 Hi Don Yang,


Thank you, This code is working fine.

When compared, I found the below line is the only difference from my script.
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;

Can you please explain how this line makes the difference.

Thanks in advance
Hareesh.


Don Yang commented Jun 05 '15, 6:12 p.m.

Hareesh,

Glad to know it works for you.
In your codes, you use var value =  workItem.getValue(WorkItemAttributes.DESCRIPTION);  in which WorkItemAttributes is used but it is not defined.
Thanks

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.