Newer Version Available

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

Overriding Buttons, Links, and Tabs with Visualforce

You can override the behavior of standard buttons—like New, View, or Edit—in Salesforce Classic, Lightning Experience, and mobile independently. You can also override the tab home page that displays when a user clicks a standard, custom, or external object tab.

To override a standard button or a tab home page:
  1. Click Edit next to the button or tab home page you want to override.
  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, 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, you can select only Visualforce pages that use the standard list controller for that tab’s associated object, pages with a custom controller, or pages with no controller.

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

    When overriding the New button with a Visualforce page, you can choose to skip the record type selection page. If you do, new records you create aren’t forwarded to the record type selection page. Salesforce assumes that your Visualforce page is already handling record types.

    When a Salesforce mobile app user clicks New to create a product, the user must select a record type even if the Skip record type selection page option is selected in Setup.

    Important

    Use a controller extension to add extra functionality to Visualforce page that you’re using as an override.

    Tip

  4. Click Save.

To remove an override:

  1. From the appropriate object’s management settings, go to Buttons, Links, and Actions.
  2. Click Edit next to the override.
  3. Select No override (default behavior).
  4. Click OK.

    When switching from Classic to Lightning Experience, if the URL contains nooverride=1 in Classic, it changes to nooverride=true in Lightning, and you don’t see overrides for the record you’re navigating to.

    Note