Calculated Value Script: workItem.getValue() Returns Zero

Environment: RTC 3.0.1.2.
Background: I'm developing a calculated value script, which itself is an attempt to work around a limitation. I want a field to be read-only once the WI progresses out of the New state. Since we can't do that yet, my idea is to hide the field once the WI moves beyond New and to have a shadow read-only field that reads and displays the value of the field I'm hiding.
The issue: whenever the script (code below) reads an attribute.....Integers come back with a value of zero and DateTimes (which I'm doing in another script) come back null. I'm only able to successfully read Enumerations.
Any thoughts?
***************************************
dojo.provide("com.moi.workitems.providers.CopyInitPlannedNumTestCases");
dojo.require("com.moi.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.moi.workitems.providers.CopyInitPlannedNumTestCases", null, {
getValue: function(attributeId, workItem, configuration) {
console.log("Entering CopyInitialPlanned()");
var initialPlanned = workItem.getValue("com.moi.workitem.attribute.initialPlannedNumTestCases");
console.log("Initial Planned number: " + initialPlanned);
return initialPlanned;
}
});
})();
Background: I'm developing a calculated value script, which itself is an attempt to work around a limitation. I want a field to be read-only once the WI progresses out of the New state. Since we can't do that yet, my idea is to hide the field once the WI moves beyond New and to have a shadow read-only field that reads and displays the value of the field I'm hiding.
The issue: whenever the script (code below) reads an attribute.....Integers come back with a value of zero and DateTimes (which I'm doing in another script) come back null. I'm only able to successfully read Enumerations.
Any thoughts?
***************************************
dojo.provide("com.moi.workitems.providers.CopyInitPlannedNumTestCases");
dojo.require("com.moi.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.moi.workitems.providers.CopyInitPlannedNumTestCases", null, {
getValue: function(attributeId, workItem, configuration) {
console.log("Entering CopyInitialPlanned()");
var initialPlanned = workItem.getValue("com.moi.workitem.attribute.initialPlannedNumTestCases");
console.log("Initial Planned number: " + initialPlanned);
return initialPlanned;
}
});
})();
3 answers

Hi Daniel,
For custom attributes you need to configure custom tag in process configuration source of your respective project area.
Your script should be modified to :
Environment: RTC 3.0.1.2.
Background: I'm developing a calculated value script, which itself is an attempt to work around a limitation. I want a field to be read-only once the WI progresses out of the New state. Since we can't do that yet, my idea is to hide the field once the WI moves beyond New and to have a shadow read-only field that reads and displays the value of the field I'm hiding.
The issue: whenever the script (code below) reads an attribute.....Integers come back with a value of zero and DateTimes (which I'm doing in another script) come back null. I'm only able to successfully read Enumerations.
Any thoughts?
***************************************
dojo.provide("com.moi.workitems.providers.CopyInitPlannedNumTestCases");
dojo.require("com.moi.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.moi.workitems.providers.CopyInitPlannedNumTestCases", null, {
getValue: function(attributeId, workItem, configuration) {
console.log("Entering CopyInitialPlanned()");
var initialPlanned = workItem.getValue("com.moi.workitem.attribute.initialPlannedNumTestCases");
console.log("Initial Planned number: " + initialPlanned);
return initialPlanned;
}
});
})();
For custom attributes you need to configure custom tag in process configuration source of your respective project area.
Your script should be modified to :
dojo.provide("com.moi.workitems.providers.CopyInitPlannedNumTestCases");
(function() {
dojo.declare("com.moi.workitems.providers.CopyInitPlannedNumTestCases", null, {
getValue: function(attributeId, workItem, configuration) {
console.log("Entering CopyInitialPlanned()");
var initialPlannedTCs = configuration.getChild("initialPlannedTCs").getIdentifier();
var initialPlanned = workItem.getValue("initialPlannedTCs");
console.log("Initial Planned number: " + initialPlanned);
return initialPlanned;
}
});
})();