Validate Date or Date/Time in Service Catalog on Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2023 11:47 PM
Hello everyone, i have a problem with validate data of MRVS. I add data to MRVS using the CSV file attached from field "Attachment File Test", the second row has wrong value as below :
It can still be submitted even though I validated it with Catalog Client Script as below:
Please someone help me ! Thank you so much !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 12:56 AM
Hi @Dinh Nguyen
I suggest check the CSV again, may the cell is not formatted as requirement.
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
12-15-2023 12:56 AM
Hi,
You should validate the date before populating it to mrvs.
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 01:30 AM
Hello @Dinh Nguyen ,
I am not sure what are the validations on
getDateFromFormat(g_form.getValue('date'), g_user_date_format);
but it is returning values even if there are some letters in there as well, it is hard to break it. Values like "2023-11-010t" are still returning 1698830596000, so don't rely on it better do the validation, when you populate from the CSV on the server side or if you want to do it on the submit, but you are going to make you life harder there with the replicate of sync logic on submit with glideAjax.
Hope that this helps you!
If the provided information answers your question, please consider marking it as Helpful and Accepting the Solution so other community users can find it faster.
All the Best,
Stefan