Overriding Standard Tab to Hide Unwanted Features Using a Simple Visualforce Page

Have you ever come across a scenario where you do not want your end users creating new records from the standard tab? Or you do not want them accessing the Reports and Tools sections from the standard tab page. If yes, then let me show you how you can easily accomplish this with three straightforward lines of Visualforce code.

Opportunity Home Tab
Opportunity Home Tab

 

Requirement: As a system administrator, I want the Opportunity Tab to be overridden for all profiles other than the System Administrator profile. The other profiles shouldn’t be able to create new records from the Opportunity tab and the Reports, Tools, Quarterly Summary sections shouldn’t be visible either.  Reason? Our company wants the users to create Opportunities only from Accounts.

Solution: This cannot be accomplished using a point and click approach since Salesforce doesn’t allow us to customize the standard tab pages. So we will create a simple VF page and then override the Opportunity Tab with this page.

  1. Create a VF page with the code below:Code
  2. Navigate to Setup -> Customize -> Opportunities -> Buttons, Links & Actions, and override the Opportunities Tab with the above VF page:Override

And voila! With just three lines of code and a simple tab override, we were able to get the desired user experience.

Result:

System Administrator Profile
System Administrator Profile

 

 

Non System Administrator Profile
Non System Administrator Profile

 

Let me know in the comments below if you accomplished such a requirement in a different manner. If you are looking for a free app that lets you do this, you must look into the following:

App
Click me!

 

Good luck!