Saving the Position Record

Now, did you forget anything? Oh yes, you still have to save the Position__c record, the main focus of the page.

You don’t want to do anything extraordinary with this record—simply take the standard actions to save the record. You can simply call the default save action for the standard controller to accomplish this task.

Except for one little problem. Remember, the save method in your extension overrides the save method for the standard controller. If you call the default save method, you find your code in an endless loop.

You can escape this problem by declaring another instance of the standard controller and then calling the save method on that instance.

7.
Add the following code to the beginning of your class ...

Get The Developer’s Guide to the Force.com Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.