Before you override a standard button, review these considerations.
Required Editions
| Available in: Salesforce Classic and Lightning Experience |
|
Available in: Enterprise, Performance, Unlimited, and Developer Editions Visualforce overrides also available in: Contact Manager, Group, and Professional Editions Record types available in: Professional, Enterprise, Performance, Unlimited, and Developer Editions |
| User Permissions Needed | |
|---|---|
| To override standard buttons: | Customize Application |
Implementation Tips
Important Before you override a standard button with a Lightning component or
Visualforce page, review implementation details in the respective developer guides.
- If you override a standard button in Salesforce, that button is still available in Connect Offline, but it retains its original behavior.
- If a button isn’t available for overrides, you can still hide it on the page layout.
- Button overrides affect everywhere that action or behavior is available. For example, overriding the New button on an account also overrides the account option in the Create New dropdown list in the Salesforce Classic sidebar.
- Person Account records use any standard button overrides that you make for accounts. Person Account records also use any overrides for the View Self-Service and Enable Self-Service buttons that you make for contacts.
- If your organization uses the Console tab, overrides for the Edit and View buttons for an object don’t affect the Edit and View buttons in the mini page layouts. Pages that display due to overrides display in the console without the header or sidebar.
- To replace a standard button with a custom button, first define the custom button, then customize the page layout to hide the standard button and display the custom one in its place.
- When you override the Edit button with a Visualforce page, you’re also overriding default
logic that checks whether the record has been locked for approval. However, you can perform the
same check by implementing the
Approval.lockApex method.
Implementation Tips Specific to the View Action
- The View standard button refers to all links in Salesforce that display the detail page for a record. Overriding the View standard button reroutes all of these links.
- The View action is the only one that supports overrides with a Lightning record page. To make a Lightning record page available for a View action override, activate it in the Lightning App Builder.
- Activating the Lightning record page assigns it as the org default for its associated object. If you activate the Lightning record page for specific Lightning apps only, the page takes precedence over the Lightning Experience Override setting for the View action on the object in those apps.
- If you have the View action overridden with a Visualforce page in Salesforce Classic, the Setup menu on that object record page in Lightning Experience displays the Edit Page option. Selecting Edit Page in Lightning Experience on an object page that’s overridden with a Visualforce page in Salesforce Classic lets you create a custom Lightning Experience record page for that object in the Lightning App Builder.
Limitations
- You can override buttons on the detail page but not the edit page of a record.
- You can only override these standard buttons: New, View, Edit, and Delete.
- For tasks in Salesforce Classic, you can only override standard buttons and links.
- You can’t change buttons on lookup dialogs, reports, or tabs. However, you can change the buttons on list view and search result layouts under search layouts.
- Action overrides on the New standard button don't work on New Object links in lookup searches.
- Action overrides on the Edit standard button disable inline editing on the corresponding record detail component in Lightning experience.
- For objects with multiple record types, the Outlook and Gmail integrations don’t support action overrides unless you choose to skip the record type selection page.
- You can’t relabel or relocate standard buttons on a record detail page.
- When overriding tabs or buttons with a Lightning component, you can select only Lightning components that implement the
lightning:actionOverrideinterface. - Visualforce overrides to standard actions such as View, New, Edit, and Delete aren’t supported in Experience Builder sites. When Visualforce overrides are applied to these actions, the buttons don’t appear on record detail pages in sites.
- A standard button (New, Edit, View, Delete, and Clone) overridden with a Visualforce page doesn’t show up in the Salesforce mobile app unless the Visualforce page is enabled for Salesforce mobile apps. Overriding standard list and tab controls isn’t supported in mobile.
- When overriding a standard action with an Aura component on an object with more than one active record type, the record type selection screen uses Salesforce Classic styling on mobile devices.
- 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 buttons with a Visualforce page, you can select only Visualforce pages that 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:<apex:page standardController="Account"> ... page content here ... </apex:page>