Help with a custom work item attribute “Calculated Value”
Hi,
Accepted answer
Support case was opened. Case is closed, there was an issue with the process configuration, as already hinted here.
3 other answers
Comments
I’m pretty sure that will do it, thanks. I’ll try this tomorrow. Cheers
not enough characters in the comment, so see post below
In addition to Davyds answer, please
If you change the script and save it in Eclipse, make sure to completely reload the page in the browser to get the newest script version.
(function() {
dojo.declare("calculated.budgetTotal", null, {
getValue: function(attribute, workItem, configuration) {
var r1 = workItem.getValue('rate_1');
var q1 = workItem.getValue('qty_1');
var tot1 = parseFloat(r1) * parseFloat(q1);
return tot1.toString();
}
});
})();
I tried changing q1 to a different (decimal) attribute and it still returns null. I can't seem to get a second attribute for the calculation.
Comments
I have checked and the "total" attribute has the rate_1 and qty_1 defined as "dependencies"
Are you sure the work item has the attribute? Check usage in the work item type or create a new work item after (refresh) modifying the attribute/work item type.
Hi, yes there is some odd issue.. I tried the script again adding two new attributes to the work item type, I created both in exactly the same way, both appear to have been added to the process config source correctly as far as I can see, however, one attribute is accessible via getValue() but the other one isn't.
Make sure that you refresh/reload. I have seen cases where I did not get the changes activated for a while.