Can I disable the download links for attachments?

bonsai
Mega Sage

I was able to control attachment uploads by making the record field read-only and hiding the clipboard icon!

However, files that have already been attached are still available for download.

Is it possible to disable the download link for attachments only for users who meet certain conditions?

2 ACCEPTED SOLUTIONS

Chaitanya ILCR
Kilo Patron

Hi @bonsai ,

you can create an onload client script with isolate script = false

add your logic to check if the user is meeting the criteria to below script and hide them accordingly

function onLoad() {
   //Type appropriate comment here, and begin script below
   hide('header_add_attachment'); //hides paper clip icon
   hide('header_attachment'); // hides attachment bar  
}

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

View solution in original post

Ankur Bawiskar
Tera Patron
Tera Patron

@bonsai 

you can hide the complete attachment header if the user doesn't satisfy certain condition

this worked for me in onLoad client script.

Ensure your onLoad client script has Isolate Script= False to allow DOM manipulation

Note: DOM manipulation is not recommended

document.getElementById('header_attachment').style.display = 'none';
document.getElementById('header_attachment_line').style.display = 'none';

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

2 REPLIES 2

Chaitanya ILCR
Kilo Patron

Hi @bonsai ,

you can create an onload client script with isolate script = false

add your logic to check if the user is meeting the criteria to below script and hide them accordingly

function onLoad() {
   //Type appropriate comment here, and begin script below
   hide('header_add_attachment'); //hides paper clip icon
   hide('header_attachment'); // hides attachment bar  
}

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

Ankur Bawiskar
Tera Patron
Tera Patron

@bonsai 

you can hide the complete attachment header if the user doesn't satisfy certain condition

this worked for me in onLoad client script.

Ensure your onLoad client script has Isolate Script= False to allow DOM manipulation

Note: DOM manipulation is not recommended

document.getElementById('header_attachment').style.display = 'none';
document.getElementById('header_attachment_line').style.display = 'none';

If my response helped please mark it correct and close the thread so that it benefits future readers.

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