Activity Forums Salesforce® Discussions What are Extension Controller's?

  • PRANAV

    Member
    January 31, 2018 at 8:49 am

    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.

  • shariq

    Member
    September 18, 2018 at 8:08 am

    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

  • Parul

    Member
    September 18, 2018 at 10:42 am

    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.

Popular Salesforce Blogs

Popular Salesforce Videos