- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 10:44 AM
Happy Friday All,
How can I prevent users from populating a DATE field with a date No Less That 5 Business Days (7 Total days from today) and No More Than 10 Business days (14 Total days from today).
Thank you for your anticipated help.
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2024 12:56 AM
It Is working fine in my pdi @Hola Ola
Refer below link
You can also write onChange Client script
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 01:44 PM - edited 09-13-2024 03:39 PM
Hi @Hola Ola
Add Below condition
In Execute if False part of the code, Use your script to clear the value.
function onCondition() {
g_form.clearValue(period_duration_required_for_the_requested_access);
g_form.showErrorBox('period_duration_required_for_the_requested_access', getMessage('Date should be 7 - 14 days in the future'));
}
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 03:31 PM
Hello @Voona Rohila ,
Thanks for your response and my sincere apologies for the bother. This is still not working as I had hoped.
I'm sure I'm not doing something right here.
I used the script you provided and the Conditions. Am I missing something in the Execute if false box?
__________________________________________________________________________
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 03:38 PM
Use below code in Execute if false.
function onCondition() {
g_form.clearValue(period_duration_required_for_the_requested_access);
g_form.showErrorBox('period_duration_required_for_the_requested_access', getMessage('Date should be 7 - 14 days in the future'));
}
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2024 10:24 AM
Hello @Voona Rohila
Thank you for sticking with me.
The issue I'm still having is demonstrated below:
Pic 1: I have the field showing the message
PIC 2: The Field still accepts a date that is only 3 days away (I am trying to restrict it to no earlier than 7 days and no later than 14 days).
Please tell me what I'm doing very wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2024 10:31 AM
@Hola Ola - I will implement and share the details.
Your date field should accept after 7-14 days only right?
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP