The CreatorCon Call for Content is officially open! Get started here.

How can i limit the number of attachments in a catalog item?

Alberto27
Tera Contributor

Hello,

We have a catalog item in which we are using the OOTB attachment and we need lo limit that the user can only attach one field but the client don“t allow us to use DOM methods.

So we need to create a Catalog Client Script or something like this to limit the number of attachments.

Anyone have do this?

Thanks to all.

14 REPLIES 14

Hello Ankur,

In this article use DOM Manipulation, and we can“t use DOM.

We need to do something like this but withoun using DOM.

Best Regards

Hi,

you want this validation for native or portal?

Regards
Ankur

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

Hi,

We need to validate on service portal, before create the item.

Regards

Hi,

inform your client that there are some use-cases where DOM is required to achieve the requirement when OOB doesn't help.

OR

you can use variable of type File attachment

Regards
Ankur

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

Filipe Cruz
Kilo Sage

Hi Alberto,

I have a solution that I tested in my PDI.

Go to your catalog item and set the "Hide Attachment" flag to false:
find_real_file.png

 

Then, add one variable of type "attachment" to your catalog item:

find_real_file.png

 

This variable will only allow you to add one attachment!!

I think this is the behavior you are expecting to see, right?


Please, if this answer is relevant for you, please mark it as correct and helpful.

Thanks,

Filipe