How to restrict user to upload only 1 attachment at a time from Portal

skumar_srbh
Tera Guru

Hi Team...

 

How to restrict users to upload only one attachment at once via the add attachment(paper clip) icon in ServiceNow portal for widgets(using clone of the widget "ticket attachment").

 

skumar_srbh_0-1672407373597.png

 

could anyone please suggest... 

Thanks in advance.

 

Regards,

Kumar

5 REPLIES 5

Sonu Parab
Mega Sage
Mega Sage

Hi @skumar_srbh ,
Please refer below thread.
https://www.servicenow.com/community/now-platform-forum/upload-single-attachments/m-p/1086203

Please mark as correct answer if this solves your issue.

@Sonu Parab  - Thanks for suggestion but that thread is not complete...  although I have similar issue wrt. the "custom widgets" & single file upload.. 

ajit kasabale
Tera Expert

Please find below :
https://docs.servicenow.com/bundle/sandiego-servicenow-platform/page/administer/notification/referen...

Also check in  Browse to the following location on the instance:  System Properties -> Security.

 

If it's helpful them mark as correct .

jaheerhattiwale
Mega Sage
Mega Sage

@skumar_srbh Tried and tested 100% working solution.

 

Add the below code in setAttachments function as shown in the image below.

 

if(attachments.length == 1){
document.querySelector(".sp-attachment-add").disabled = true;
}else{
document.querySelector(".sp-attachment-add").disabled = false;
}

 

jaheerhattiwale_0-1672673208009.png

 

Please mark as correct answer if this solves your issue.

 

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023