How to check the size of attachment in catalog item?

Meghant Rai
Kilo Guru

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 5 MB. If it is more than 5 Mb then it should throw an alert and abort the action. Hence user will not be able to submit the catalog item with that file.

Kindly help how to achieve this requirement.

3 REPLIES 3

AnirudhKumar
Mega Sage
Mega Sage

Hello Meghant,

At first I did not think this would be possible. But after searching for similar stuff on community I found this post

However you can only do this if the attachment variable is being used rather than the OOB clip icon to attach.

Meghant Rai
Kilo Guru

@Ankur Bawiskar  : Would you be able to help here

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

It's difficult to determine this as you won't find record in sys_attachment when you are in Portal.

there is a record which gets created in sys_attachment with sc_cart_item table but it works only in native

So I would suggest this

1) create variable of type Attachment and add the max_file_size=5 in variable attributes

Types of service catalog variables

Regards
Ankur

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