issue with on submit script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2024 05:49 AM
below code is working UAT but not in PROD. anything is wrong
function onSubmit() {
var hiredate = g_form.getValue('hire_date');
var rehiredate = g_form.getValue('rehire_date');
var augdate = '2024-01-01';
if (hiredate > augdate || rehiredate > augdate) {} else {
g_form.addErrorMessage("Users are eligible after June 2024");
return false;
}
}
Labels:
- Labels:
-
Incident Management
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2024 05:52 AM
It could be something to do with date time format.
-Anurag
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2024 06:34 AM
ok but anything wrong in the script, or let me know any other way can do this validation
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2024 06:43 AM
I would use something like this to compare dates
Comparing Client Dates - ServiceNow Community
-Anurag
