It's all about the answers!

Ask a question

calculation of Task Age based on Due Date

Rao Shines (15945162) | asked May 07 '18, 7:25 a.m.
edited May 08 '18, 4:22 a.m.

We have a business requirement that task age to be calculated based on the due date assigned for first time and ignore calculation if its updated in later time.

Task age (in days)  = Current date - Due date(assigned first time only)

The following script returns Task age based on due date but when ever due date is changed task age is also getting updated which should not be case, is there a way the scripts needs to be taken into account only the first time assigned due date and ignore subsequent modifications in due date.


(function() {
    var WorkItemAttributes=;
    dojo.declare("taskage", null, {

        getValue: function(attribute, workItem, configuration) {
var t1=;
var t2= new Date();
if (t1 === null) return "";
var diff =, t1, "day");
return diff;

RTC version used is 6.0.2

Thanks in Advance.

One answer

permanent link
Surendranath Matta (132) | answered Apr 16 '19, 10:00 a.m.

 The value WorkItemAttributes.DUE_DATE is updated when due date is updated. So it will ALWAYS return the current value stored.

if you want the ORIGINAL  due date, then store it in a different attribute ( say ORIG_DUE_DATE )and set its value when due date is initially set. Then you can use it as workItem.getValue(WorkItemAttributes.ORIG_DUE_DATE)

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.