- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 06:42 AM
I want to create a catalog item with a variable which accepts date. Same should show in Service Portal Custom Widget.
Below conditions to be applied in Service Portal Widget when user selects date and submit:
When user requests a catalog item, it should check if the date entered in date variable is it from past. If yes, then it should display one alert message, and it should clear the value from date field and abort the submission.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 06:50 AM
I didn't get this part -> Same should show in Service Portal Custom Widget.
You can validate date entered in date variable is in past using Catalog UI policy
No Code date validations through (Catalog) UI Policies
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
01-15-2024 07:04 AM
Hi @VikramM1 ,
U can create a variable of type Date & Make it mandatory. U can create UI policy where condition can be date_field before today n then in script section select UI type as ALL & under Execute if true u can write below command.
alert('Past Date cannot be selected');
g_form.clearValue('date_field');
As it is mandatory after clearing the value it will again become mandatory hence will force user to enter proper date before form submission.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 06:50 AM
I didn't get this part -> Same should show in Service Portal Custom Widget.
You can validate date entered in date variable is in past using Catalog UI policy
No Code date validations through (Catalog) UI Policies
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
01-15-2024 07:04 AM
Hi @VikramM1 ,
U can create a variable of type Date & Make it mandatory. U can create UI policy where condition can be date_field before today n then in script section select UI type as ALL & under Execute if true u can write below command.
alert('Past Date cannot be selected');
g_form.clearValue('date_field');
As it is mandatory after clearing the value it will again become mandatory hence will force user to enter proper date before form submission.
Thanks,
Danish