How to check the size of attachment in catalog item?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2022 07:11 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2022 07:22 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2022 03:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2022 06:33 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader