Calculated Field Javascript Help
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:
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
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
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.
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.