Validate date and time on a due date field that the entered value is not in the Past
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 01:21 AM
Hi Team,
I have a requirement to validate the entered date and Time is not in the past on the incident due date field.
I've tried to achieve this via Client Script and a Script Include.
The onChange Client script I have written on change of due date:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 01:27 AM
Hello @Supritha3 ,
If you want to just validate if the fields selected due date is not of past you can do it via Ui policy only. just follow below screenshots and you will be able to achieve it.
Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 01:49 AM
Hi Nayan,
Thank you for the suggestion, but I want this validation on change of the due date and not onload of the form.
The user should not be allowed to chose the due date in past during the selection itself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 01:54 AM
Hi @Supritha3 ,
The UI policy approach which I shared with you is also onchange it will work if the user tries to select the due date of past. And if you do not want this to work on load just uncheck the onload checkbox.
Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 02:30 AM
Hi Nayan,
Again this only validates the date and not the time. suppose a user selects the same date and like a few hours before the current time it still allows to save.