If start time of Change is in business hours, a new mandatory field needs to display.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2024 12:44 AM
We have a requirement on Change Requests, that a new mandatory field be visible to users if they select a state time for their Change that is within business hours. I know how to set this to appear Mon-Fri, but I need to be able to also get it to only show if they select the start time as being between 08:00 and 18:00 Mon-Fri. How would I achieve this with a Client Script please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2024 02:11 AM
Tried this and get this error on the Planned Start Date field -: onChange script error: TypeError: id.indexOf is not a function function () { [native code] }
This appears immediately as you open a Change Request, and the u_workinghours field is visible at all times, instead of being hidden.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2024 01:56 AM
Try like this in UI policy
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2024 02:29 AM
This seems to conflict with an existing Client Script that validates that the input start date/time is before the end date and throws up errors similar to everyone elses suggestions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2024 04:44 AM
Any other ideas anyone? The planned start date field is a Date/Time field.
When using a UI Policy to go off Mon-Fri, it works. As soon as you try to trend on the time, it errors and gives this -:
onChange script error: TypeError: userDate.getHour is not a function function () { [native code] }
Scripts above just do not work at all
No Client Scripts have anything like this in them, nor Script Includes, UI Pols or Business Rules have this that would relate to Change...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2024 05:16 AM