2

My client is using Professional Edition. They want to remove or hide the 'Attach File' button from the Notes & Attachments Related list which is available in Account,Contact and Opportunity objects. I know this is the standard one so we cannot do any customization.I have searched so many forums then I came to know that we can achieve this by using some VF code and Javascript code. I tried the below links but I am not able to get the correct solution. Can anyone please guide me on this.

http://salesforceapexcodecorner.blogspot.in/2012/02/remove-attachment-button-from.html

Hiding "New Note" button

http://boards.developerforce.com/t5/General-Development/Remove-Attach-File-button-on-Note-amp-Attach...

  • 2
    Since the client is on Professional Edition, there is not much they can do to stop the users from uploading attachments, assuming they have access to the Notes object. The first solution you linked to is viable; you would need to construct an entire Visualforce page, and override the Detail pages of the records with the Visualforce page. The second solution is also viable, and simply requires some JavaScript and tweaking the settings for the organization (show custom sidebar on all pages, etc). This is probably the "best" practical solution you can reach in Professional Edition. – sfdcfox Jul 1 '13 at 12:06
  • @sfdcfox Thanks for your answer. I will try with JavaScript code. – Arun Jul 1 '13 at 12:35
1

I have written Javascript to hide both Attach File button from Notes & Attachment related list and Discover Summer 13 button from home page. We need to include the below javascript code in Home page components then we have add this into Home page layout as a Narrow left column.

Then we have to make sure to disable the “Enable Separate Loading of Related Lists” and to enable the “show custom sidebar components on all pages”


function hideBtns() { if(window.location.href.indexOf('.salesforce.com/006')!=-1){ j$("[name*=attachFile]").hide(); }if(window.location.href.indexOf('.salesforce.com/001')!=-1) { j$("[name*=attachFile]").hide(); }if(window.location.href.indexOf('.salesforce.com/003')!=-1){ j$("[name*=attachFile]").hide(); } if(document.getElementsByName('whats_new')[0]!=null) document.getElementsByName('whats_new')[0].style.display = 'hidden'; if(document.getElementsByName('whats_new')[1]!=null) document.getElementsByName('whats_new')[1].style.display = 'hidden'; } if (window.addEventListener) { window.addEventListener('load', hideBtns, false); } else if (window.attachEvent) { window.attachEvent('onload', hideBtns); }   function hideBtns() { if(document.getElementsByName('whats_new')[0]!=null) document.getElementsByName('whats_new')[0].style.display = 'none'; if(document.getElementsByName('whats_new')[1]!=null) document.getElementsByName('whats_new')[1].style.display = 'none'; } if (window.addEventListener) { window.addEventListener('load', hideBtns, false); } else if (window.attachEvent) { window.attachEvent('onload', hideBtns); }

0

Why not write a trigger to prevent users from uploading a note or attachment? It would be a simpler solution for your problem. However if client wants to remove the button from the UI for some reason than the only option is to do it via creating a inline vf page with javascript to hide the attch file button.

  • Because they're on Professional Edition (no Apex Code). – sfdcfox Jul 2 '13 at 3:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.