+ Start a Discussion

How to get Standard Buttons using Custom controller



I wanted to know if at all this can be achieved.


Assume that i have a VF page that Overrides the "New" Button on Account Object.

I would force the user here to search for already existing accounts and then if the search returns "No Results", i shall then show the "New" button to create the Account.


How can we accomplish this? Can any one provide me some pointers on this.

Your help is highly appreciated.




Best Answer chosen by Admin (Salesforce Developers) 
John De SantiagoJohn De Santiago

From your controller method you can return a page reference that directs the user to the account edit page with a parameter of 'nooverride=1'. This will direct the user to the standard account edit/new page bypassing the visualforce page.



PageReference pageRef = new PageReference('/001/e?nooverride=1');


return pageRef;