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

Calculated Attribute (Field) not working

Any thoughts on what I am missing in the scenario below?

I am trying to get a very basic Calculated Attribute working in RTC. Here is what I have done:

1. Added new Calculated Value Attribute Customization called RiRankCV. The local file path of the Java Script is c:\AATemp\RiRank.js. The attachment path is /workitem/scripts/common/RiRank.js. I have confirmed that the script is attached to the Project Area in the Project Area Links tab.

2. The script at c:\AATemp\RiRank.js is as follows. Right now, all it does is return the value 3:

dojo.provide("com.example.RiRank");

(function() {
dojo.declare("com.example.RiRank", null, {

getValue: function(attribute, workItem, configuration) {

return 3;

}
});
})();

3. For the work item, I added a new custom attribute called RiRank of type Integer with a Calculated Value = RiRankCV

4. I added the new custom attribute to the work item presentation.

5. I set the property "Enable Process Attachment Scripts" = true and confirmed in the ccm teamserver.properties file that com.ibm.team.workitem.process.scripts.enabled=true

6. I would expect that when I create and save a new work item that uses this attribute, the attribute value would be set to 3, but nothing happens. I have checked the logs and I don't see any activity. I have tried setting a breakpoint on the object using Firebug, but it doesn't get hit. It appears as if the javascript is not executing.

Any thoughts on what I am missing?

0 votes



2 answers

Permanent link
Thanks Claudia. I found out from the developer that this area actually has a bug:

https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=169693

In short, returning an Integer does not work when the data type of the attribute is an Integer. When I changed the attribute type to a String, it worked. A fix is supposed to be included in the next Ifix.

1 vote

Comments

Nice, this comment saved me for SO much trouble!! :-)


Permanent link
Just sharing some tips that helped me to work with attribute customizations, especially when using javascript files:

1- if you make any change to the .js file, ensure it reloads into the project. you can go to the XML code and insert a blank, so you can save the project area reforcing the file to be reloaded.

2- ensure the data type that you are returning in the function, matches the data type of your attribute.

Now, based on the description that you posted, it seems to me that you are expecting like a default value, not a calculated one. Are you sure you are using the appropriate provider?

--Claudia

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

Question asked: Jul 29 '11, 12:31 p.m.

Question was seen: 4,993 times

Last updated: Nov 22 '12, 7:43 a.m.

Confirmation Cancel Confirm