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
Ben MertonBen Merton 

Use VisualForce to bypass tab home page

I am trying to create a simple VisualForce page that bypasses the standard tab on a custom object.  This custom object only has one record, so the History view is unnecessary.  I want anyone clicking on the tab to be directed to that one record (i have the id).

How should I query this page in the Visualforce code, so that any Visualforce changes I also make are made to this record?
Vinoth Vijaya BaskerVinoth Vijaya Basker
Hi Ben, 

Please find the following Sample code, 
<apex:page standardController="Parent__c" extensions="TabController">
    <apex:detail subject="{!RecordId}" relatedList="false"/>
Here, I am using a custom object called Parent__c. You can replace it with your custom object.
public class TabController {

    public TabController(ApexPages.StandardController controller) {

    public Id getRecordId(){
        Parent__c recordForWebTab = [SELECT Id FROM Parent__c WHERE Name = 'NameOfRecord' LIMIT 1];
        return recordForWebTab.Id;


Create a web tab for the VF Page that you created, 

Please use the below line as URL for Webtab 

When you clicked the custom tab, Detail page of record will be displayed.

Based on your requirement, you can change the WHERE Condition of SOQL Query. 

Please let me know, if you have any questions. 

Hello Ben,

Following is the my solution for your requirement. I am considering "Fundraiser__c" as a custom object.

1. Create a VF page which will show detail page of the record using standard controller. Vf page (ObjectHomePage1) code as follows
<apex:page standardController="Fundraiser__c" showHeader="false" >
            <apex:detail showChatter="true"  />

2. Create a another VF which we will use this for creating tab. VF page(ObjectHomePage) code as follows
<apex:page controller="ObjectHomePageCtrl">
           <apex:iframe src="/apex/ObjectHomePage1?id={!}"/>
public with sharing class ObjectHomePageCtrl {

    public ObjectHomePageCtrl() {
        Fundraiser =  [Select Id from Fundraiser__c limit 1];

    public Fundraiser__c Fundraiser{get;set;}


3. Create a VF tab to call ObjectHomePage Vf page.

Finall it will call show the standard detail page of a record.

Let me know if it helps you.

Anjith kumar.
Hi Ben,

In this Case Visualforce Tab would be helpful where you can put your logic to jump on a specific record what you want. you can make it available to all other users also.

Sandeep Singhal