function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Visualforce Page to hide New button on Custom Object Tab

I have spent a day trying to resolve an issue and I am so close! But I think the final solution is beyond my abilities...

I have a custom object (Event) where I would like to hide the New button on the Object Tab - I want to force people to create the Event from the Related List on another object (Inquiry).


Initially I tried to override the Button with a simple error message page I made with guidance from this blog - - but that impacts the usage of the New button everywhere, including my Related List on Inquiry.


I got really excited by this post - - which lead me to override the custom tab with a simple Visualforce page with EnhancedList, or even just ListView - but both still include the New button.  There is a comment on that post that claims "If you just want to hide the new button, modify the selector" but I don't know how to do that.


Thanks in advance for any assistance! Hopefully I will eventually get past the copy-and-paste-other-peoples-markup phase...

Doublehead SoftwareDoublehead Software

Unless I am missing something, a custom object has a setting in the search layouts section to handle that.  It is under search layouts called object name + List View.    There is an option to turn off the new button when in list view.  Just uncheck the "new" checkbox.


Wow, I feel silly now because that totally makes sense.  By overriding the page with the ListView then it takes those settings from the Object List View Search Layout. 




Can you please describe in detail what did you do to hide the New button on Custom Object Tab with the help of List view? 


STEP 1: Create a simple Visualforce page (this example uses the Bookings Object)

Your Name > Setup > App Setup > Develop > Pages

Select the New button.  Add a descriptive label (IE: Bookings Tab Homepage Override) and tab to auto-create a Name (which you can then shorten/customize).

Salesforce will automatically start you off with some default Visualforce Markup:

To replace the tab homepage with a list view, you will need to delete the default Markup and paste the following:

<apex:page showHeader="true" tabstyle="API Name">

<apex:sectionheader title="Plural Label" subtitle="Home"></apex:sectionheader>

    <apex:ListViews type="API Name" />


  • Tabstyle > defines which Tab is highlighted in the header when you are viewing this page
  • Sectionheader Title & subtitle > Every tab homepage includes this information. The Subtitle always reads “Home” and will display larger than the Label
  • ListViews Type > The standard list view that would be seen if someone hit “Go” on the homepage.  You can also utilize the <apex:enhancedList> option here for more control over attributes like height, rows per page, etc.

For the Booking Object (custom):

So the resulting Markup for this page is as follows:

<apex:page showHeader="true" tabstyle="lod4__Event__c">

<apex:sectionheader title="Bookings" subtitle="Home"></apex:sectionheader>

    <apex:ListViews type="lod4__Event__c" />



Step 2: Override the Standard Page with your new Visualforce Page
Now that the new page is created, we need to tell Salesforce to display it when users click the Tab. From Your Name > Setup > App Setup > Create > Objects, select your object and the Standard Buttons and Links related list. Select Edit next to the Label (Object) Tab line item to open the Override Properties window.
By Default, the Override With will show No Override (use default), change this to Visualforce Page and select your page (as named in Step 1) from the picklist.


Save your changes. You will now see your page marked as Overridden:


Step 3: Modify the Buttons displayed on your new Page

This page format will re-create a list view the home Tab for your Object, but it will now include ListView buttons for New (Object) and Change Owner:


To hide these buttons, go to Your Name > Setup > App Setup > Create > Objects and select your custom object. Go to the Search Layouts Related List and select Edit next to the (Object) List Viewline item.


Uncheck the New [New] option and Save.  Optionally, you can remove the Change Owner button as well.


Now you have a new Tab Landing Page which does not offer any options for creating New Records!


Step 4: Grant users Access to your Page

The last step is to grant access to Users so they can see your lovely Visualforce page.

To accomplish this do the following:
Go to the Setup | Develop | Pages
You will see The Following:

Click on the Security link next to your page. It will take you to the Page Level Security Page.
Select the Profiles from the Left side and click the Add button to Enable them - Click save.
***Note: This gives the Access to this VF Page only, each VF Page is independent. So if you like to give access to more VF Pages then you must repeat the steps for that Page. ***


Awesome! This works. Thank you!

Vince O'DonnellVince O'Donnell
I am close, in these lines: 

<apex:page showHeader="true" tabstyle="lod4__Event__c"> 

what does the lod4 mean before the API name? 
venkat raj 10venkat raj 10
Hi  MonkeyKristi,
I fallowed all the steps but i am not getting any page after opening booking tab .
i also have doubts 
1. <apex:ListViews type="API Name"
 on above api name which api name can i place.
2.<apex:page showHeader="true" tabstyle="lod4__Event__c"> 
what is "lod4__Event__c?