Extending control

There are times where it might make more sense to use a custom controller, for example, if the page is not tied to a specific type of sObject. However, there are also times where the page is tied to a specific type of sObject and the standard controller makes more sense, but you just need one extra bit of data or functionality. Unfortunately, pages can only use either a standard controller or a custom controller, but not both.

Don't worry though, there's a simple solution. While you cannot use both a standard controller and custom controller, you can extend either of them with a controller extension. As you probably guessed, an extension is just an Apex class that follows certain syntax. Extensions really do allow you to have ...

Get Learning Apex Programming 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.