I am trying to build a controller extension for the Opportunity standard controller.
According to documentation and stackexchange I ought to be able to override the Save() action in the controller extension. I have a VF page that is embedded in the standard Opportunity layout and a save() method in the controller extension, but the save() method in my controller extension never gets called.
What am I doing wrong?
The VF page - embedded in the standard Opportunity layout:
<apex:page standardController="Opportunity" extensions="TestExtension" showHeader="false" >
</apex:page>
The controller extension class - I get the constructor debug message, but not the one from save():
public without sharing class TestExtension {
ApexPages.StandardController stdController = null;
public TestExtension(ApexPages.StandardController stdController) {
this.stdController = stdController;
System.debug('==== TestExtension: TestExtension() ====');
}
public PageReference save() {
System.debug('==== TestExtension: save() ====');
// do some stuff
Pagereference ref = stdController.save();
// some more stuff
// give control back to standard controller
return ref;
}
}