- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2022 02:29 AM
Hi Everyone,
I have an use-case where I need to make the duration to be selected after 15 days from the current date. How can I achieve this? Please help!!
Example: If I'm filling this form today, then I want the days from 15 to 29 to be greyed or not possible to select and only days after 15 days user should be able to select.
Regards,
Priya
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2022 11:49 PM
Hi,
Please try UI policy if it still not resolved.
1. use relative condition as below and select your date field and give 15 days as shown below.
with this you can select date after 15 days from current date.
Script:
function onCondition() {
alert("Enter valid date, You can select date after 15 days from today");
g_form.clearValue('select_the_duration'); //give your variable name
}
Hope you it helps you.
Please Mark ✅ Correct/helpful if applicable, Thanks!!
Regards
Pavankumar
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2022 04:07 AM
Hi Ankur,
Thank you so much for your time!
But now, 'select the duration' field gets blank when we select the date 15 days from now and even the field gets blank for the date selected after 15 days too.
What other changes shall I make to get the field blank only for the days selected 15 days from now?
Thank you in advance!
Regards,
Priya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2022 08:18 PM
Hi,
So the validation is running fine.
Did you debug why it's clearing for the case where it shouldn't?
regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2022 11:49 PM
Hi,
Please try UI policy if it still not resolved.
1. use relative condition as below and select your date field and give 15 days as shown below.
with this you can select date after 15 days from current date.
Script:
function onCondition() {
alert("Enter valid date, You can select date after 15 days from today");
g_form.clearValue('select_the_duration'); //give your variable name
}
Hope you it helps you.
Please Mark ✅ Correct/helpful if applicable, Thanks!!
Regards
Pavankumar
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2022 05:24 AM
Hi,
Thank you so much Pavan. This worked!!
Regards,
Priya