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
flewellsflewells 

Using visualforce page/tab to replace custom object tab...but slow to load

Hi there, I have a custom object for which I want to display a tab, but I do not want to show its standard New button. As I'm not aware of any ability to hide the standard New button on a custom object home tab, my solution is to create a Visualforce page/tab that takes the user directly to the object's list views (have also modified the List View settings within Search Layout options to hide buttons from list views) and show this to my users this instead of the custom object tab.

 

My solution is functional, but when I click on the Visualforce tab, it is much slower to load than any other standard/custom object tab. I'm an experienced Administrator with limited knowledge of Visualforce -- is there a different way to approach solving my requirement (hide standard New button)? Are there tweaks that I could make to my Visualforce page to make this work better?

 

The Visualforce page I created is very simple (CO is name of custom object):

 

<apex:page id="CO__c" >
    <apex:enhancedList type="CO__c" height="500" rowsPerPage="25" id="COList"/>
</apex:page>

 

 

Any advice on how to approach this differently? Can you think of changes to my Visualforce page that could improve page load time?

 

Thanks in advance,

Kristin

 

P.S. I have also tried overriding the custom object tab with my Visualforce page (instead of creating a Visualforce tab). That worked except in Internet Explorer -- if using Internet Explorer, the user was directed to the login page after clicking on the overridden custom object tab. Not good!

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

If you want to hide the new button, does that mean that you don't want any user to be able to create a new instance of the custom object?  If that is the case, removing the create permission for the object from user's profiles will cause the new button to be hidden from them.

 

If you want users to be able to create a new instance, but not through the standard page, you can override the new button so that the user is taken to a visualforce page of your choosing.

 

Unfortunately Visualforce pages are slower than standard pages.

All Answers

bob_buzzardbob_buzzard

If you want to hide the new button, does that mean that you don't want any user to be able to create a new instance of the custom object?  If that is the case, removing the create permission for the object from user's profiles will cause the new button to be hidden from them.

 

If you want users to be able to create a new instance, but not through the standard page, you can override the new button so that the user is taken to a visualforce page of your choosing.

 

Unfortunately Visualforce pages are slower than standard pages.

This was selected as the best answer
flewellsflewells

Bob, thanks for your reply. In addition to Visualforce pages being slower than standard pages, I'm wondering if my Visualforce tab is even slower because it needs to load the data for a list view.

 

I still need my users to create new records for the custom object and have a custom button (content source: URL) for them to use for that purpose. I'll have to consider your suggestion to replace the URL with a Visualforce page. My visualforce page to replace the custom object Home tab seemed preferable because it means zero maintenance, whereas I would expect a visualforce page that is used for data entry to require maintenance over time (i.e when we add new fields to the page)...

 

Thanks again.

bob_buzzardbob_buzzard

Have you looked at using field sets?  That's what we tend to use now if we want to be able to add fields to a page without having to revisit the visualforce.  You don't have the same degree of control that you would otherwise, but its a reasonable compromise.

 

I wrote a blog post detailing this at:

 

http://bobbuzzard.blogspot.com/2011/02/visualforce-field-sets.html

flewellsflewells

I haven't looked at using field sets but just took a quick read of your blog post.  Will play around with that, could be a viable solution here.

Starz26Starz26

You can hide the buttons on the enhancedList by using CSS

 

.btn:not(.avoidMe){

 

display:none;

 

}

 

Then create your custom buttons and give them the styleClass="avoidMe"

 

If you just want to hide the new button, modify the selector