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
upsetstomachupsetstomach 

Customize save action

I want to customize the save() action for a custom object.  I created an apex class that extends my custom object's standard controller.  I created a visualforce page and set the apex:page tag with my standard controller and extension.  My question is ... if I add that visualforce page to my custom object's Standard Layout,  when the SAVE button is pushed will my controller extension's save() method be executed or does it still execute the save() method of the Standard Layout's object?  It appears to me that the latter is true. 

 

To get my controller extension's save() method to execute do I have to create a stand alone visualforce page and not try to leverage the Standard Layout?

Pradeep_NavatarPradeep_Navatar

If you are using standard controller with the extensions then you need to just change the name of save() method and it will work fine. When we use standard controller and use standard method like save() and cancel(), then it invokes standard method of standard controller.