It's all about the answers!

Ask a question

Date validation: Cannot read property "DUE_DATE"

Akshay Panchakshari (37329) | asked Jun 09 '16, 10:07 a.m.
edited Jun 09 '16, 10:18 a.m.

I am trying to do date validation.Two fileds are involved here one is in-build "Due date" and the second is the custom field extended date. But when the script is triggered i get the below error:

!ENTRY 4 0 2016-06-09 19:31:57.154
!MESSAGE Error invoking validator
!STACK 0 Unexpected exception type
 at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(
 at java.lang.reflect.Method.invoke(
 at com.sun.proxy.$Proxy41.validate(Unknown Source)
Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "DUE_DATE" from undefined (date-validator.js#24)
 at org.mozilla.javascript.ScriptRuntime.constructError(
 at org.mozilla.javascript.ScriptRuntime.constructError(
 at org.mozilla.javascript.ScriptRuntime.typeError(
 at org.mozilla.javascript.ScriptRuntime.typeError2(
 at org.mozilla.javascript.ScriptRuntime.undefReadError(
 at org.mozilla.javascript.ScriptRuntime.getObjectProp(
 at org.mozilla.javascript.gen.c19._c2(date-validator.js:24)
 at org.mozilla.javascript.ContextFactory.doTopCall(
 at org.mozilla.javascript.ScriptRuntime.doTopCall(
 at com.sun.proxy.$Proxy55.validate(Unknown Source)
 ... 11 more

Below is my javascriot code for the same. --


dojo.require(""); // We need the date class from Dojo to compare two dates
dojo.require(""); // We need the stamp class to work with ISO date strings

(function() {
var Severity =;
var Status =;
var WorkItemAttributes =;
var DateValidator = dojo.declare("org.example.DateValidator", null, {

    validate: function(attributeId, workItem, configuration) {
        // Get the configuration parameters about the severity and error message of this validator
        var severity= configuration.getChild("parameters").getStringDefault("severity",;
        var message= configuration.getChild("parameters").getStringDefault("message", "");
        // Get the Due date attribute

         // Get the current attribute's value and make a Date object from it
  // Compare the two dates and make sure extendedDate is not earlier than dateRequiredBy
  //If the dateRequiredBy > extendedDate = +ve else -ve
        if (, extendedDate) <= 0) {
            return Status.OK_STATUS;
        } else {
            return new Status(Severity[severity], message);

The above code was workin fine in RTC version 3.0.1. recently i have upgraded to RTC 4.0.3 and the script does't work here. WorkItemAttributes.DUE_DATE is not supported or changed in RTC 4.0.3

Please advice what is the issue here ?


One answer

permanent link
Akshay Panchakshari (37329) | answered Jun 09 '16, 10:31 a.m.

Hi All!

Found the issue!!

the below line of code was missing-



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.