Look up script on a DATE field
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 01:52 PM
Hello,
Please I need a look up script that will ONLY allow the current or future date to be selected in the date field.
Thank you.
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 03:54 PM
Hi @Austine
You can achieve this using Ui policy.
Below link might help you.
Vishal Birajdar
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 10:24 PM
Hi @Austine ,
You can use onChange client script for date field.
script for reference:
var enteredDate = g_form.getValue('u_glide_date_1');
var rightNow = new Date().valueOf();
var datetocheck = new Date(enteredDate).valueOf();
if(datetocheck < rightNow){
g_form.addErrorMessage('select the correct date');
g_form.setValue('u_glide_date_1');
Mark my answer correct and helpful if helps you.
Thanks,
Nivedita Patil.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 11:42 PM
you can achieve this through ui policy
if you get answer please mark helpful and accept solution