How to validate a CSV file upto 10KB or limit the number of rows upto 20 records in a catalog item?

User205031
Tera Contributor

Hi All,

I have a requirement where I have to measure the size of the attachment while submitting the catalog item.

The attachment should not be more than 10 KB. If it is more than 10 KB then it should throw an alert and abort the action. Hence user will not be able to submit the catalog item with that file.

 

or, is there any way to check the number of rows in the CSV file up to 20 records? If there is more than 20 records it will abort the action and user wont be able to submit the cat item.

 

Kindly help how to achieve this requirement.

 
1 ACCEPTED SOLUTION

@User205031 

you should use Attachment type variable with this variable attribute

Also check this link for onchange client script to validate the rows, you will have to enhance it by using CSV Parser

Validating an attachment variable 

Check docs for more help

Types of service catalog variables

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

6 REPLIES 6

@User205031 

Would you mind closing your earlier questions by marking appropriate response as correct?

Members have invested their time and efforts in helping you.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Thanks @Ankur Bawiskar , it worked.