How to remove attachments 'Edit' button in custom table of service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2022 09:31 PM
hi,all
I need to remove the edit button at the top next to the attachment in the form of my custom table from service portal,but also we can download the attachment.
I tried the Client Script with the following method that worked but we can't see and download attached file any more
function onLoad() {
var attachmentButton = top.document.getElementsByTagName('sp-attachment-button');
attachmentButton[0].parentNode.hidden = true;
top.document.getElementsByClassName('sp-attachment-manager')[0].style.display = 'none';
}
And I also tried ACL in sys_attachment,it looks doesn't work.
I wanted to know from where this edit button is coming on the portal form.
Kindly let me know if you have any suggestions?
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2022 09:37 PM
Hi
You can hide attachments from Service Portal using DOM manipulation but it is not best practice to use DOM manipulation. You can try below code in OnLoad Client script
Table -Your required table name
UI Type - Mobile/Service Portal
Type - onLoad
Isolate Script - Set it to false/Uncheck
function onLoad() {
var attachmentButton = top.document.getElementsByTagName('sp-attachment-button');
attachmentButton[0].parentNode.hidden = true;
top.document.getElementsByClassName('sp-attachment-manager')[0].style.display = 'none';
}
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2022 01:06 AM
@Sandeep Dutta
Thank you for your answer.
I have tried the onLoad Client Script . It works that disable attachment icon and edit button.
But I can't see and download the attached file generated from other system connection.
Can you tell me how to remove the edit button and can still download the attachment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2024 02:05 AM
I have met the same problem. And I use the code below to solve it. Please refer code as below.
function onLoad() {
var attachmentButton = top.document.getElementsByTagName('sp-attachment-button');
attachmentButton[0].parentNode.hidden = true;
var el = top.document.getElementsByClassName('sp-attachment-manager')[0];
if (el) {
el.getElementsByTagName('button')[0].style.display = 'none';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2024 02:08 AM
Please refer the code as below.
function onLoad() {
var attachmentButton = top.document.getElementsByTagName('sp-attachment-button');
attachmentButton[0].parentNode.hidden = true;
var el = top.document.getElementsByClassName('sp-attachment-manager')[0];
if (el) {
el.getElementsByTagName('button')[0].style.display = 'none';
}
}