Validate Date or Date/Time in Service Catalog on Portal

Dinh Nguyen
Kilo Sage

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 : 

 

DinhNguyen_2-1702626130290.png

It can still be submitted even though I validated it with Catalog Client Script as below: 

DinhNguyen_3-1702626341808.png

Please someone help me ! Thank you so much !

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

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]

****************************************************************************************************************

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi,
You should validate the date before populating it to mrvs.

 


Thanks and Regards,

Saurabh Gupta

Stefan Georgiev
Tera Guru

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