onChange script error: ReferenceError: 'validateStartDateBeforeEndDate' er ikke defineret function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2019 02:30 AM
When using ui policies to set start date and end date automatically i get this error when create new change. The error appears in New York but worked fine in London release
Listed below is error in screendump, the policy and further down the error in text
******* UI Policy ******
function onCondition() {
function AddZero(num) {
return (num >= 0 && num < 10) ? "0" + num : num + "";
}
var n = new Date();
g_form.setValue('end_date',AddZero(n.getDate()) + "-" + AddZero(n.getMonth() + 1) + "-" + AddZero(n.getFullYear()) + " " + AddZero(n.getHours()+12) + ":" + AddZero(n.getMinutes()+5) + ":" + AddZero(n.getSeconds()));
g_form.setValue('start_date',AddZero(n.getDate()) + "-" + AddZero(n.getMonth() + 1) + "-" + AddZero(n.getFullYear()) + " " + AddZero(n.getHours()+6) + ":" + AddZero(n.getMinutes()+5) + ":" + AddZero(n.getSeconds()) );
}
*** ERROR ****

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2019 02:33 AM
Error seems to be from a different script, it should be a onchange client script which is throwing this.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2019 11:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2020 03:10 AM
it looks like the client script now checks that the ui script exists. here's a snippet:
if (typeof validateMaxDateDuration !== "undefined") { // Need to check if the method exist in case StartEndDateValidation UI Script has been skipped during upgrade
Have you got the latest patch?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2020 08:04 AM
Though this is a six months old post, I am posting an answer here as many others can get benefitted from it.
According to the error, Javascript compiler has not been able to find method validateStartDateBeforeEndDate function within the UIScript, this OOTB function is part of UI Script with the name "StartEndDateValidation". Check if this UI Script exists in your instance. Since this UI Script is not a global script, one has to load this script with an onLoad client script, OOTB does it using OOTB client script "Date Validation Load" which is defined for both change_request and change_task. Once both these scripts are there on the instance, the compilation error would go away on its own.