Help with clent script in a MRVS to enforce a time selection between start and end times
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
Hello,
I really need help for the forum Guru's. I am in the process of creating a booking catalog request form. The request consists of a single day, multiple days, and long term booking options. For the single day, I just used the form variable of Date, and select boxes for start time and end time. I was able to create client scripts that prevented a user from entering a start time after the end time, and a end time before a start time. Both onchange of the start time and end time variables. To prevent submission I added a on submit script. They work great. But when I applied the same logic to a MRVS it did not work. The multiple days.short time mvrs also has a date field and a start time and end time. I tried to use the exact same client script for the onchange but every time the user filling out the form could choose a start time after the end time and a end time before the start time. I was told by another developer that this is common for MRVS especially when trying to validate an expression.
It that true? If you can help or you can validate that what I want to do cant be dome, please let me know.
I included the start time script below:
- Labels:
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
Hi @Brett25 ,
I don’t think there is an issue with your client script specifically related to MRVS.
Could you please share more details about the problem and include some screenshots? That would make it easier to review and verify the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
Good morning, As you can see from my screen shot I have the client script working on the request for. It validates a select box field as a time field and compares it to another time field and the provide a error message when the conditions are meet, such as start time less that end time, start item and end time are the same and end time is before start time. When i applied the exact same logic, changing the fields names to the MRVS, no error message appeared, and the user was able to submit the incorrect times
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
Hi @Brett25 ,
Instead of using client script, use UI policy to easily validate date fields.
See Images.
No Code date validations through (Catalog) UI Poli... - Page 2 - ServiceNow Community
If this solves your query mark this as correct/helpful.
Thanks
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
Thank you for the response. Unfortunately the function that you are referencing in the UI policy does not work for a select box field which the start time and end time are. Servicenow does not have a specific time field.
