Restrict user to select past 24 hrs in date/time field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 07:43 AM
I have a date/time field. Need to restrict it from selecting less than 24 hours.
For ex :
today is 17th June 9:10:00 and users should not be allowed to select less than 16th June 9:10:00
i.e if a use selects 16th June 9:09:00 --> It should throw an error

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 08:00 AM
You can have a UI policy in place, something as
Resolved - relative - before - 24 hours from now
And add the script by marking Run script as true and add below line execute if true.
g_form.showFieldMsg("field_name","Select within 24 hours","error");
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 10:41 PM
Hi,
Can you pl once again confirm that it is before 24 hours from now or ago.
Because I am checking if the time is less than 24 hours ago -> it should give an error.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 11:55 PM - edited 05-15-2023 02:02 AM
Oh the logic that I shared would show error if date is selected beyond 24 hours.
The logic is fine, what you can do instead of Execute, if true, put the script in Execute, if false
Make sure execute if false is checked in the UI policy.
g_form.showFieldMsg("field_name","Select within 24 hours","error");
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2022 01:07 AM
Hello @bharathk1116
The best solution is to use an advance qualifier for your field. Indeed you can create you own custom filter in a scriptInclude and call it in advance qualifier.
It'll not show the day you don't want in the calendar so the user experience will be better than getting an error.
If you need some help to do that tell me.
Mark it as helpfull if it is 🙂
Regards,
Theo