It's all about the answers!

Ask a question

Calculated Field Javascript Help


Paul Wellman (71119) | asked Mar 16 '12, 11:29 a.m.
Greetings,

I am currently trying to create a calculated field that displays a number value/calculation of two other fields entered into a workitem.

To start I am simply trying to access the value of one of the fields using the following code:


dojo.provide("com.example.ValueProvider");
(function() {
dojo.declare("com.example.ValueProvider", null, {

getValue: function(attribute, workItem, configuration) {
var test_stringAttribute = workItem.getValue("com.ibm.team.workitem.attribute.hrs");
var hours = Number(test_stringAttribute);
return hours;

}
});
})();


The Custom Field is "com.ibm.team.workitem.attribute.hrs" and I am trying to display this in a read only field on the work item.

I have created a Calculate Value entry in the Attribute Customization area of my Project Area using the above code in a Javascript File. The necessary permissions have been enabled along with the necessary dependencies.

Could anyone provide me with some guidance or the location of a basic step by step tutorial. All of the examples on the jazz wiki assume I have extensive knowledge of deploying the actual scripts.

Thank you so much for any help you may have.

Regards,

Paul

2 answers



permanent link
Ralph Schoon (57.7k23642) | answered Mar 23 '12, 4:51 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Paul,

in RTC 3.0.1.x you go to the process configuration.....work items>work item customization. There you create your calculated value provider and upload your script. It is automatically attached to the process (Links>attachments). You then add the calculated value provider to your attribute and check the dependent attributes so that you get triggered on changes.

There is also an article in the library that walks you trough this, I think.

Comments
Juan Pablo Bruno commented Aug 09 '12, 4:29 p.m.

How can you see the "work item customization" option from the web ui?


permanent link
Juan Pablo Bruno (26410) | answered Aug 09 '12, 4:28 p.m.
How can you see the "work item customization" option from the web ui?

Comments
Vince Thyng commented May 07 '14, 1:09 p.m.

The work item customization is not in the web ui, only eclipse.  At least not the attribute customization settings that you are implementing.

Your answer


Register or to post your answer.