how to use UI policy for date validation and clear that multiple field for catalog form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 06:08 AM - edited 10-03-2022 06:57 AM
I created a UI policy where we take dates from the form.
How to write a script that
- if the user enters past dates then clear the selected field.(if user select start_date wrong then clear that field only not the other and same for the start_end date too)
- if the user enters the date_start and date_end if the date_end is less than date_start then clear the date_end field.
how to achieve this with one UI policy.
I created a UI policy for all date validation conditions but I can't clear the selected field if the user selects the wrong date.
This is the catalog form date 1 is date_Start and date 2 is date_end.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 06:48 AM
Hello,
Please follow the article "https://www.servicenow.com/community/developer-articles/no-code-date-validations-through-catalog-ui-..." you should be able to achieve your requirement
Please mark answer correct/helpful based on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 06:55 AM
yes, I followed that article only my problem is how to achieve these steps.
- if the user enters past dates and then clears the selected field.
- if the user enters the date_start and date_end if the date_end is less than date_start then clear the date_end field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 07:09 AM
I see then you will have to move the conditions inside the run script.
I see two ways to proceed from here:-
If you want to keep the condition in the filter itself either you clear both the values in case of any one condition fails
OR
You move the condition in the run script and use a if else.
Please mark answer correct/helpful based on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 07:35 AM
I created the script but not working as excepted can you please check