Calculated Value not working
I have a script to calculated value bases on 2 other attributes. When I change either of the 2 attributes, nothing happens. any ideas, here is the script: we are on 6.0.1 ifix 003
dojo.provide("com.ce.team.workitem.attribute.riskProbabiltyCostProvider");
|
Accepted answer
Found the issues we were having
1. forgot to establish the dependencies for thecalculated value, hence it was never firing.
2. get child was not working, so we changed code to:
dojo.provide("com.ce.team.workitem.attribute.riskProbabilityCostProvider");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes"); (function() { dojo.declare("com.ce.team.workitem.attribute.riskProbabilityCostProvider", null, { getValue: function(attribute, workItem, configuration) { try { //console.log("Executing cost provider"); var consequenceCost = parseInt(workItem.getValue("com.ibm.team.workitem.workItemType.risk.consequencecost")); //console.log("Cost = " + consequenceCost); var probabilityAttribute = workItem.getLabel("com.ibm.team.workitem.workItemType.risk.probability"); //console.log("Prob Enum: " + probabilityAttribute); var probability = this.__getLastIntSegment(probabilityAttribute); //console.log("Probability: " + probability); var calcCost = (consequenceCost * probability) / 100; return calcCost.toString(); } catch(err) { var txt; txt="There was an error on this page.\n\n"; txt+="Error description: " + err.message + "\n\n"; txt+="Click OK to continue.\n\n"; console.log(txt); } }, //end getvalue __getLastIntSegment: function(identifier) { if (identifier != null) { var lastSeparator = identifier.lastIndexOf('%'); //console.log("Sep index: " + lastSeparator); var numberString = identifier.substring(0,lastSeparator); //console.log("Number: " + numberString); return parseInt(numberString, 10); } return -1; }, __sentinel: null }); })();
We now have it working, thanks for all the feedback.
Ralph Schoon selected this answer as the correct answer
|
2 other answers
Did you update the application to allow process attachment scripts to run?
Comments
Homer Pope
commented Apr 18 '16, 7:55 p.m.
Thanks, This was the first thing we did.
Homer Pope
commented Apr 18 '16, 7:56 p.m.
and still nothing, how can we tell if it is firing?? |
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.