Activity Forums Salesforce® Discussions What is the basic difference between Standard, Custom and Extension Controllers in Salesforce?

  • Subhendu

    Member
    January 12, 2018 at 6:37 am

    Hello Kapil,

    The Controllers are used to control data behavior on a Visualforce Page. If you want your page to have the standard behaviors that are provided by Salesforce than you will be using Standard Controllers. Salesforce Provided standard controllers for most of the standard and custom objects.

    Extensions are not actually controller, they are used to extend the functionalities of a standard salesforce controller. These are used in conjunction with standard controllers. You can have a single controller and multiple extensions on a visualforce page.

    The custom controllers are apex classes which are used provide custom behavior to a visualforce page.

    Hope this clarifies you on your query.

    Thanks,
    Subhendu

  • Parul

    Member
    September 18, 2018 at 6:40 pm

    Hi

    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.

    controller extension is an Apex class that extends the functionality of a standard or custom controller. Use controller extensions when: You want to leverage the built-in functionality of a standard controller but override one or more actions, such as edit, view, save, or delete.
    You want to add new actions.
    You want to build a Visualforce page that respects user permissions. Although a controller extension class executes in system mode, if a controller extension extends a standard controller, the logic from the standard controller does not execute in system mode. Instead, it executes in user mode, in which permissions, field-level security, and sharing rules of the current user apply.

    If you want your page to have the standard behaviors that are provided by Salesforce than you will be using Standard Controllers. Salesforce Provided standard controllers for most of the standard and custom objects.

     

    Thanks

  • shariq

    Member
    September 19, 2018 at 9:33 pm

    Hi,

    Standard Controllers
    Contains the same functionality and logic that are used for standardSalesforce pages. Can be used with standard objects and custom objects.

    Custom Controllers
    Need finer control for how information is accessed for your page, you can write a custom controller or a controller extension using Apex. Only one Apex class is used.

    Hope this helps.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos