Hi,
I am wondering if anyone on this forum is able to help me please.
I have created a script which updates a status read only field on a work item based on Agreed and actual date (Script below)
dojo.provide("com.example.KPIcalc");
(function() {
dojo.declare("com.example.KPIcalc", null, {
getValue: function(attribute, workItem, configuration) {
var agreedDate = workItem.getValue("ID-FOR-AGREED-DATE-FIELD")
var actualDate = workItem.getValue("ID-FOR-ACTUAL-DATE-FIELD");
if (agreedDate != null && actualDate == null) {
//if agreed date and actual date are null, return UNASSIGNED
//return "com.ibm.enum.kpistatus2.literal.l2";
return "ID-FOR-KPI-STATUS-LITERAL-UNASSIGNED";
}
if (agreedDate != null
&& actualDate != null
&& agreedDate >= actualDate) {
//if agreed date is not null, actual date is not null, and agreed date is after or the same as actual date, return COMPLETED ON TIME
//return "com.ibm.enum.kpistatus2.literal.l4";
return "ID-FOR-KPI-STATUS-LITERAL-COMPLETED-ON-TIME";
}
if (agreedDate != null
&& actualDate != null
&& agreedDate < actualDate) {
//if agreed date is not null, actual date is not null, and agreed date is before actual date, return COMPLETED LATE
//return "com.ibm.enum.kpistatus2.literal.l6";
return "ID-FOR-KPI-STATUS-LITERAL-COMPLETED-LATE";
}
//else return "in progress"
//return "com.ibm.enum.kpistatus2.literal.l8";
return "ID-FOR-KPI-STATUS-LITERAL-IN-PROGRESS";
}
});
})();
When I create a calculated script based attribute customisation and assign this to the applicable attribute on the work item it all works.
The status is correct populating dependent on the dates entered..
My issue......
When I fresh the work item or hard refresh (ctrl+f5) the status field resets getting rid of any value that was assigned. I then have to reset the dates for the status field to correctly populate.
Is there something I am missing that will stop a fresh resetting any calculation made on a workitem?