
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2021 10:02 PM
Hi Team,
I would like to disable attachment icon(paper clip icon) in both native view as well as in portal page for "report Vaccination" record producer. The record producer is on scoped application. Please help me here to achieve this.
Below is my catalog client script ,
Type : onload
UI type : All
script :
function onLoad() {
document.getElementById("sc_attachment_button").hide();
}
Any input on this would be much appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2021 02:11 AM
Till the you can use this script. It would work in portal and native both
function onLoad() {
//Type appropriate comment here, and begin script below
if(window == null){
var z = this.document.getElementsByClassName("panel-button sp-attachment-add btn btn-link");
z[0].style.display = 'none';
var k = this.document.getElementsByClassName("file-upload-input");
k[0].style.display = 'none';
var aTags = this.document.getElementsByTagName("span");
var searchText = "Add attachments";
var found;
for (var i = 0; i < aTags.length; i++) {
if (aTags[i].textContent == searchText) {
aTags[i].style.display = 'none';
break;
}
}
}
else{
document.getElementById("sc_attachment_button").hide();
}
}
Portal Output:
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2021 10:07 PM
Hi,
For Portal you can hide it using Hide Attachment checkbox
For native you can use onLoad Catalog Client Script
Ensure Isolate Script Field for client script is Set to False
function onLoad() {
document.getElementById("sc_attachment_button").hide();
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2021 11:28 PM
Hi Ankur,
Hope you are doing good and Thanks for the inputs.
My catalog client script is working after I unchecked the isolate script. but it is working only for native view not on portal.
I couldn't find hide attachment check box in the form layout. Please provide your input on the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2021 11:33 PM
Hi,
Hide attachment should be present under Portal settings as I shared image above
If the Hide Attachment checkbox is not visible on form then from the list layout you can set it to false
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2021 11:37 PM
The field is available but it is in inactive state(updated by system).
is there anyway I could do it without the help of this checkbox?
Thanks.