- 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-16-2022 03:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2022 04:15 AM
when your UI policy executes, does it clear the value from the field?
Thanks
Harshad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2022 04:27 AM
Hi,
No, it doesn't
Thanks,
Priya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2022 04:43 AM
use this instead clearValue.
g_form.setValue('select_the_duration', ' ');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2022 05:21 AM
Hi Harshad,
I've made the above changes.
- When I select the duration which is 15 days from today, the field gets blank. It's working opposite to my requirement.
- So, what changes should I do to make the field blank if I select 15 days from now and not after 15 days from now..
I tried few things, but that did not work.
Regards,
Priya