Newer Version Available

This content describes an older version of this product. View Latest

Overriding Buttons, Links, and Tabs with Visualforce

Salesforce lets you override the behavior of standard buttons on record detail pages. In addition, you can override the tab home page that displays when a user clicks a standard, custom, or external object tab.

Before you override a standard button, review the considerations for overriding standard buttons.

Important

To override a standard button or a tab home page:
  1. Navigate to the appropriate override page.
    • For standard objects, from Setup, click Customize, select the appropriate object or tab link, then click Buttons, Links, and Actions.
    • For custom objects, from Setup, click Create | Objects, and select one of the custom objects in the list.
    • For external objects, from Setup, click Develop | External Objects, and then select one of the external objects in the list.
    Click Edit next to the button or tab home page you want to override.

    Since events and tasks don't have their own tabs, you can only override their standard buttons and links.

    Note

  2. Pick Visualforce Page as an override type.
  3. Select the Visualforce page you want to run when users click the button or tab.
    When overriding buttons with a Visualforce page, you must use the standard controller for the object on which the button appears. For example, if you want to use a page to override the Edit button on accounts, the page markup must include the standardController="Account" attribute on the <apex:page> tag:
    1<apex:page standardController="Account">
    2<!-- page content here -->
    3</apex:page>

    When overriding tabs with a Visualforce page, only Visualforce pages that use the standard list controller for that tab, pages with a custom controller, or pages with no controller can be selected.

    When overriding lists with a Visualforce page, only Visualforce pages that use a standard list controller can be selected.

    When overriding the New button with a Visualforce page, you also have the option to skip the record type selection page. If selected, any new records you create won't be forwarded to the record type selection page, since it assumes that your Visualforce page is already handling record types.

    Use a controller extension when you need to add extra functionality to Visualforce page that you are using as an override.

    Tip

  4. Optionally, enter any comments to note the reason for making this change.
  5. Click Save.
    Button overrides are global throughout Salesforce because overrides control the action behind the button. For example, if you override the New button on opportunities, your replacement action takes effect wherever that action is available.
    • The Opportunities home page.
    • Any opportunities related lists on other objects such as accounts.
    • The Create New drop-down list in the sidebar.
    • Any browser bookmarks for this Salesforce page.

To remove an override:

  1. Navigate to the appropriate override page.
    • For standard objects, from Setup, click Customize, select the appropriate object or tab link, then click Buttons, Links, and Actions.
    • For custom objects, from Setup, click Create | Objects, and select one of the custom objects in the list.
  2. Click Edit next to the override.
  3. Select No Override (default behavior).
  4. Click OK.