Calculated Value script not behaving as expected
![]()
Hi All,
I have a calculated value script applied for integer attribute in each transition of open the attribute value will get incremented. But the count getting incremented twice. For Eg:. 2,4.. Find the script below. dojo.provide("com.ibm.team.scripts.defect.test"); dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes"); (function() { var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes; dojo.declare("com.ibm.team.scripts.defect.test", null, { getValue: function(attribute, workItem, configuration) { var defectstate = workItem.getLabel(WorkItemAttributes.STATE); var reopencount = workItem.getValue("ae.corp.etisalat.workitem.attribute.test"); var count = parseInt(reopencount); if (defectstate == "New") { return count+1; } else { return count; } } }); })(); Regards, BalaMurugan S |
Comments
Hy Bala,
Try this and you will see it very fast, where it crashes.
I guess, there'll be a problem with the defectState.
Or you have a trigger behind the WorkItem which increments it automatically if you work with that value/WI.
console.log("defectstate")
console.log(defectstate)
if (defectstate == "New"){
console.log("Return ++");
return count+1;
} else {
console.log("Return norm");
return count;
}