- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 03:07 AM
Hi,
I need to allow user only to select date in date field that is one week later from today date. I have created one field that is date type field in catalog item.
I need to allow user only to select date that is 1 week later from today date.
Can anyone please help me to achieve that.
Regards,
Nivedita
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 03:28 AM
Hi @niveditakumari
You can create one Catalog UI policy to do the validation.
PFB.
Hope this helps.
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 03:31 AM
no scripting required. you can simply use UI policy and you need not worry about the date format
No Code date validations through (Catalog) UI Policies
use this in UI policy condition
Your Date relative before 7 days from now
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 03:46 AM
Hello @niveditakumari
You can achieve this requirement using UI policy.
Refer the screenshot for more details:
Ui Policy Configuration:
Ui Policy script to show error message:
function onCondition() {
g_form.showErrorBox('date',"Please select date after 7 days from today");
}
Result:
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 03:28 AM
Hi @niveditakumari
You can create one Catalog UI policy to do the validation.
PFB.
Hope this helps.
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 04:31 AM
Hi @J Siva,
Thank you. It is working as expected.
Can you please make me understand condition which you have added in ui policy date relative before 7 days from now, it should after or before.
Can you please make me understand that condition.
Regards,
Nivedita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 04:39 AM
The condition "relative before 7 days from now" means the selected date must be earlier than 7 days from now.
We want to show the error message if the date is selected within the next 7 days and that's the reason it should be before.
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 07:48 AM
Hi @J Siva,
I need to allow user to select date after 7 days but it should calculate only business days not weekend. In our project as per client we follow Friday, Saturday as weekend and I need to exclude Friday, Saturday. When user select date then it should calculate for Sunday, Monday, Tuesday, Wednesday, Thursday as business day.
Can you please help me with that.
Regards,
Nivedita