Standard Buttons Redirect to Visualforce Page

8:40 PM

Sometimes, we would want the Standard buttons (like NEW, EDIT, VIEW etc) to take the user to a Visualforce page.

This article discusses in detail about the various options available.

Overriding Standard Buttons

For Custom objects Navigate to Set-up >>> Create >>> Objects >> and navigate to the object. For Standard objects navigate to Setup >>> Customize >>> Object >>> Buttons and Links


Let's Override the 'NEW' button. Click on the 'Edit' link next to the 'NEW' button. You will see a page as below.


After selecting the 'Visualforce Page' radio button, you can select the page of your choice from the drop down beside.

NOTE:

Sometimes, you might not be able to see your Visualforce Page in the dropdown. This is because for your Visualforce page to be listed here, it should have the 'standardController' attribute on the 'apex:page' tag set to the current object you want to override.

For ex: If you want to override the 'NEW' button of 'ACCOUNT' with a Visualforce Page named 'ACCNEWVF', then the visualforce page should look something like this
<apex:page standardcontroller="Account" extensions="customext">
    
     Your code here

</apex:page>


How to Bypass the Override and go to the standard action??

For View: https://xxx.salesforce.com/recordid?nooverride=1
For Edit  : https://xxx.salesforce.com/recordid/e?nooverride=1

0 comments