function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sales4cesales4ce 

How to get Standard Buttons using Custom controller

Hi,

 

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.

 

Thanks,

Sales4ce

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.

 

Example:

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

pageRef.setRedirect(true);

return pageRef;