How to override the Salesforce New Button



In salesforce we can override the standard buttons likes New, Edit, View and Delete Button. We can customize button in salesforce classic, lightning, and salesforce mobile.Depends the environment, we can override it. The feature is of the new Button is we can able to pre-populate values and customize the field alignments with our design.

1. Salesforce Classic Override : We can override salesforce classic by visualforce page. This page markup must be include the standard Controller attribute on the <apex:page> tag.         

2. Lightning Experience Override : We can override lightning component using lightning: action Override in lightning component.

3. Mobile Override : It will same as lightning experience.

Here we have shown the example of how to override the “New” button on account in salesforce classic.

Step-1: we need Visualforce page, if we override the salesforce classic.

Create a new Visualforce page like below and must include the standard Controller = “Account” attribute on the <apex:page> tag

Step-2: Go to Setup.

Step-3: Go to the account customization setup pages, by clicking objects and fields| Object Manger | account | button, Links, and Actions.

Step-4: Then click the Buttons, links, and actions section.

Step-5: Now all the buttons are display like below image. Then choose the “New” button and click the Edit on right side corner drop Down.


Step-6: Then select the visualforce page through this drop.

Step-7: After that click the save button.

Tips:

  • We can choose to skip the record type selection page. This will not forwarded to the record type selection page.
  • Salesforce assumes that our Visualforce page is already handling record types.

Step-8: After that go to Account tab and click the New button on Account tab, it will redirect to our customized New Page.

Final Output: Screenshot for our customize page:

Reference : Limitations.

Click here to view more Salesforce blog post.