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
Shane K 8Shane K 8 

Overwrite New button with Visualforce page


Is it possible to achieve this functionality?

I would like to override the standard New button with visualforce page, which I know is possible, but based on some criteria I want to call a either a custom lightning component or the standard New button functionality. I will be using a controller to check my criteria but want to know how to use the standard New button functionality if the criteria does not meet. How to leverage the standard New button functionality?

ANUTEJANUTEJ (Salesforce Developers) 
Hi Shane,

By default there is a way to mention that in lightning you can use lightning component and in classic you can mention to use visual force page.

Does this help?

Also, I would suggest you to have a look at the below link that mentions a way to conditionally render in visualforce page.


I hope this helps and in case if this comes handy can you please choose this as best answer so that it can be useful for others in the future.

Abhishek BansalAbhishek Bansal
Hi Shane,

There is a detail tag in the apex which you can use in your VF page if you want to show the standrad layout. Please see the VF page code below:
<apex:page ...............>

	<apex:outputPanel rendered="{!showStandardPage}">
	<apex:outputPanel rendered="{!!showStandardPage}">
		....... show lightning component........
Let me know if you have doubts .

Abhishek Bansal.
Kallu KaliaKallu Kalia