It's all about the answers!

Ask a question

Why does the age calculation script not working?

Maria Amalan (784366) | asked Mar 28 '14, 12:29 a.m.
edited Mar 28 '14, 11:19 a.m. by Stephanie Taylor (24115)
 I have followed the steps given in the below article to calculate age of defect. But even though all steps have been followed, the age is not getting calculated. I am using RTC Is there some step that is missing in this article that I should be doing?

Someone please help! Thanks!

Krzysztof Kaźmierczyk commented Mar 28 '14, 4:02 a.m.

Hi Maria,
What do you mean that it is not calculated? Does it still has value 0? Do you have any error in ccm.log or in application server log?

2 answers

permanent link
Krzysztof Kaźmierczyk (7.5k477103) | answered Mar 28 '14, 4:06 a.m.
Also this document how to troubleshot calculated values should be useful:
Let us know if it helped.

permanent link
Dinesh Kumar B (4.1k413) | answered Mar 28 '14, 7:22 a.m.
the return values from the script you are trying to use is of the form "2 d, 20 hr, 34 min" which is best suited for a string attribute. 

so, please verify if the ItemAge attribute which uses the script is of type string (small/medium/large - any is fine).

i have just verified using the script from and observe that
a.  when its applied on a TimeStamp attribute, the value remains at "None" - no change observed due to the execution of the script
b.  when applied on a small string attribute, the value shows up correctly and is of the form "2 d, 20 hr, 34 min"

hope this helps

Maria Amalan commented Mar 28 '14, 7:42 a.m.

Thanks for this info Dinesh.
I have created attribute with type as small string, given the AgeCalculation script under Calculated Value and Modified Date as dependency.
So when I modify the defect, the age should get calculated based on the creation date and modified date. But it is still not happening.

Dinesh Kumar B commented Mar 28 '14, 8:01 a.m.

could you check if the Enable Process Attachment Scripts property is set to true?

you can reach this property from your CCM admin page

if this is already set, I would suspect some syntax error in the code causing the script to fail. 

Use Firebug with Firefox, reload the work item page, check from the scripts tab if this script is getting listed... you can even set a break point here and do a step through

Maria Amalan commented Apr 01 '14, 2:47 a.m.
Thanks Dinesh. 
Enable Process Attachment Scripts property was set to false. I have now changed it to true and redone the whole setup. The script that I am using is a tried and tested bit of code from the below link. I believe the age has to appear every time we modify the defect. But no value appears when I modify the defect. I don't think there is any syntax error because its a published function. What else could be the reason? 

Dinesh Kumar B commented Apr 01 '14, 3:50 a.m.

do you find the script loading successfully on the firefox firebug script console!

i would suggest setting a breakpoint and stepping through to see where its going wrong...

Your answer

Register or 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.