Activity › Forums › Salesforce® Discussions › What are Extension Controller's?
Tagged: Controller Extension, Custom Controller, Field Level Security, Salesforce Apex, Salesforce Visualforce Page, Standard Controller
-
What are Extension Controller's?
Posted by Suryadeep on January 31, 2018 at 6:43 AMWhat are Extension Controller’s and how can we create them?
Parul replied 7 years, 7 months ago 4 Members · 3 Replies -
3 Replies
-
Hi,
A custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user.
A controller extension is an Apex class that extends the functionality of a standard or custom controller. They are used when you
- to leverage the built-in functionality of a standard controller but override one or more actions, such as edit, view, save, or delete.
- to add new actions.
- to build a Visualforce page that respects user permissions.
For more you can refer to the standard apex guide.
Hope this helps you.
- [adinserter block='9']
-
Hi,
A controller extension is any Apex class containing a constructor that takes a single argument of type ApexPages.StandardController or CustomControllerName, where CustomControllerName is the name of a custom controller you want to extend.
The extension is associated with the page using the extensions attribute of the <apex:page> component.
Because this extension works in conjunction with the Account standard controller, the standard controller methods are also available. For example, the value attribute in the <apex:inputField> tag retrieves the name of the account using standard controller functionality. Likewise, the <apex:commandButton> tag references the standard account save method with its action attribute.
Multiple controller extensions can be defined for a single page through a comma-separated list.
Thanks
-
This reply was modified 7 years, 7 months ago by
shariq.
-
This reply was modified 7 years, 7 months ago by
-
You want extend existing controller’s functionality, leverage the native controller’s actions or Custom controller’s enhanced functionality.
Controller Extensions are also useful as a way to organize functionality, providing more modularity and readability.
<apex:page controller=”Account” extensions=”AccountControllerExtension[,extension2,extension…]”>
thanks
Log In to reply.