Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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;
}
});
})();

0 votes



3 answers

Permanent link
Hi Daniel,

did you add the attributes, especially the others, as dependent attributes?

0 votes


Permanent link
Hi Daniel,

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;
}
});
})();

0 votes


Permanent link
Add the following custom tag next to <script> tag in process configuration source as follows.

<valueProvider....>
<script class=""/>
<initialPlannedTCs id=""/>
</valueProvider>

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 11,052

Question asked: Mar 07 '12, 6:45 p.m.

Question was seen: 7,928 times

Last updated: Mar 07 '12, 6:45 p.m.

Confirmation Cancel Confirm