Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Restricting file type in catalog client script.

bhuvana srini
Tera Contributor

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.

2 REPLIES 2

1__AnithaHV
Kilo Sage

Hi @bhuvana srini 

 

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

Not applicable

Hi @bhuvana srini ,

 

Simplest way to achieve this is using Variable Attributes.

Add allowed_extensions=xls;xlsx; in variable attributes of your attachment field.

Sai149_0-1716280543977.png

 

If Excel

Sai149_1-1716280600038.png

 

If not excel

 

Sai149_3-1716280625235.png

 

- 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.