- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2024 10:19 PM
Hi All,
On a catalog date variable i want to allow only past dates not today date or future date. how we can do using the UI polices.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 12:44 AM
Hi @Yasin Shaik11 ,
Uncheck the Onload checkbox from UI policy & the script u should write in false condition. After making this changes please check it will work.
Thanks,
Danish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 12:30 AM
Oke, but your condition is now actually on before today, so past dates. Can you try changing that?
And please also share what is in your script.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 12:34 AM
Can you please tell me what condition should i mention there? for only past dates allow
If true
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 12:42 AM
we don't have the on before today in the condition builder. can you check from your side as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 12:44 AM
Hi @Yasin Shaik11 ,
Uncheck the Onload checkbox from UI policy & the script u should write in false condition. After making this changes please check it will work.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2024 10:27 PM
Hi @Yasin Shaik11 ,
You can create a UI policy with condition date - before - today.
Then go to the script tab in UI policy & check run scripts & make sure u make Run scripts in UI type as ALL. & paste below script.
function onCondition() {
alert('Only past dates can be selected');
g_form.clearValue('date');
}
Thanks,
Danish