Suppose, you have created a flow which will create Opportunity and this process is invoked by a custom button (Create Opportunity) on the Account object. In this case, you might want to override New button available in Opportunity tab(Recent records) with the Visualforce page and clicking on it, should throw an error message saying that Opportunity can be created by clicking on Create Opportunity button in Account record.
Also, provide a back button in the VF page and code for the same is given below:
<apex:page standardController="Opportunity"> <p>You cannot create an opportunity from here, instead click on Create Opportunity button by going to Account Detail page.</p> <apex:form> <apex:commandbutton action="{!cancel}" value="Return" rerender=""/> </apex:form> </apex:page>
Pingback: Tip#16 – Overriding Standard New button | SutoCom Solutions