Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

How to Remove Attachment icon on Record Producer

chintu2
Kilo Contributor

if i am using " g_form.disableAttachments" I am getting this error : in portal it was saying : g_form) [DEPRECATED] Method disableAttachments is deprecated and unsupported on mobile

can any one suggest me what is the best way to do

8 REPLIES 8

chintu2
Kilo Contributor

I have tried :



var attachment_header = document.getElementById('sc_attachment_button');


attachment_header.style.display='none';



or



var ma = gel('header_attachment_list_label');  


  ma.style.display = 'none';



but no luck since in portal we have :



<sp-attachment-button></sp-attachment-button><span style="padding-left:4px;">${Add attachments}</span>


elilima
Giga Contributor

Hi there,



I was having the same issue when trying to hide the attachment button and icon on a Record Producer on the Service Portal. Finally found something that is working for me:



function onLoad() {


        var attachmentButton = top.document.getElementsByTagName("sp-attachment-button");


        //console.log(attachmentButton);


        attachmentButton[0].parentNode.hidden = true;


}



Regards,


Eli de Lima


Hernan3
Kilo Contributor

This worked for me however, the attachment icon is still available within the Service Catalog. Just thought I would throw that out there. Thanks, again!


Florian_R
Mega Sage

No need for a script to remove the icon from the attachments in a record producer (San Diego Version).
Go to Maintain Item > Show Hide Attachment column in list > Set to true for your record producer