How can I hide the “Edit file nam” button for attached files in CSM?e

html5lv2stu
Tera Contributor

While working with the out-of-the-box [sc_cat_item] in CSM, I noticed that the “Edit File Name” button (pencil icon) appeared when I attached a file.

I was able to hide this button using a stylesheet, but is it possible to clone the widget itself, edit the relevant section, and configure it so that the button doesn’t appear in the first place?

I suspect it’s likely `csm_sc_cat_item`, but I think I’ll need to clone not only that but also the page or widget it’s referenced in to edit it.

I’m having trouble identifying that specific page.

Thank you for your help.

 

2 REPLIES 2

lochuynh33
Tera Guru

Hi @html5lv2stu 

Please use the script below by creating an OnLoad Client Script on the relevant table where you want to hide the Edit button.

 
function onLoad() {
var editButton = top.document.querySelector('button[aria-label*="Edit file name"]');
if (editButton) {
editButton.style.display = 'none';
}
}

⚠️ Note: This approach relies on DOM manipulation, which is generally not recommended as it may be impacted by platform updates or UI changes.

If this response was helpful, please consider marking it as Helpful or Correct so others in the community can benefit.

Thanks!

Ankur Bawiskar
Tera Patron

@html5lv2stu 

you will have to use DOM manipulation for this which is not recommended.

Please inform your customer about this

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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