I wanted to share a little bit of knowledge I was able to scrape together on how to hide standard buttons in Salesforce. You don’t need any special developer skills, but you do need to be an admin in your org to do what is in this post.
In my particular scenario, I wanted to hide the Data.com CLEAN button from non-Data.com licensed users as this would produce an error indicating insufficient privileges for them, which is a “no-no” in my book.
I took the steps from THIS POST and made some tweaks. Below is a bit more information about each step for those not familiar with the terminology contained in the original post.
STEP 1 | Gather required identifiers
You will need to gather some information about the buttons you want to hide. I use the old-fashioned “View Page Source” from the context menu in Firefox and then a CTRL+F to find the button code. I was looking for the unique identifier of the button (id or name) and once I had that, I could move on to finding the field in the User object that controls data.com user provisioning.
I used Eclipse’s schema browser to traverse the User fields until I found what I was looking for – UserPermissionsJigsawProspectingUser (Boolean) – in my case and once I had that, I could move on to STEP 2.
- I know it (and love it)
- It has unparalleled cross-browser support (very important)
The first line references the jQuery CDN on Google
The subsequent lines use the value of our User field to determine if we should hide the buttons and run the rest only after the page has been loaded:
Put both of these elements into a .js file (in order as shown) and move on to STEP 3.
STEP 3 | Create a new document in Salesforce
Log into Salesforce (as an admin) and create a new document. Use the .js file you just created as the source of that document and name it and put it in a folder so you (and other admins) can recognize it in the list of documents.
Before you move on to STEP 4, record the ID of the document you just created (it’s in the URL).
STEP 4 | Create a new Home Page Component
In order for this code to run regardless of what page the user is on, include it as a sidebar Home Page Component:
- Click Your Name | Setup | Customize | Home | Home Page Components
- Click New
- Name it (again, something obvious) and choose HTML Area as the type and click
- Choose NARROW as the position and paste the following in the HTML area:
NOTE: The file ID from STEP 3 should be put into the ID after the “file” parameter.
- Save the component
STEP 5 | Add the component to home page layout
We have everything we need to seal the deal and now it’s just a matter of adding it to the default home page layout:
- Click Your Name | Setup | Customize | Home | Home Page Layouts
- Edit the Default Layout and check the box next to your new component
- Position the new component at the bottom (it should be there by default)
- Click Save
This is the moment of truth. Either edit your own profile or your test profile (yes, you should have one) and login as it to make sure the buttons are shown/hidden based on your criteria.
I hope this helps clear up how you might go about hiding standard buttons without creating multiple page layouts (may not solve your problem) or custom VisualForce pages (need development resources). I was surprised how easy it was and that it worked on the first try. I hope it does for you too!