Restricting file type in catalog client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2024 12:54 AM
Hi All,
Thanks in advance.
I have an requirement to restrict the files attachment in catalog item. I created a variable called "Attach a File" and its type attachment. User should attach a file only in "Excel" format. otherwise it should throw a alert message should not submit the catalog item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2024 01:14 AM
You can check the below thread which has the solution. Hope this helps to resolve your issue.
Solved: Re: How to validate attachment to accept only JPG ... - ServiceNow Community
Thanks & Regards,
Anitha H V

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2024 01:38 AM
Hi @bhuvana srini ,
Simplest way to achieve this is using Variable Attributes.
Add allowed_extensions=xls;xlsx; in variable attributes of your attachment field.
If Excel
If not excel
- Other way of doing this is call script include from client script & query attachment table and check the attachment type.
I started answering community questions recently. If my answer helped you in any way, please mark it as helpful or correct. It would be a great boost.