Activity Forums Salesforce® Discussions Standard and Custom Controllers

  • Nikita

    Member
    August 19, 2019 at 6:18 am

    Hi Piyush,

    Standard Controller:

    • The standard controller in apex inherits all the standard object properties and standard button functionality directly.
    • It contains the same functionality and logic that are used for standard Salesforce pages.
    • It can be used with standard objects and custom objects.
    • It can be extended to implement custom functionality using extensions keyword.
    • It provides a save method to allow you to persist changes.
    • You’d use this when you have a single object to manipulate.

    Custom Controller:

    • It is an Apex class that implements all of the logic for a page without leveraging a standard controller.
    • Custom Controllers are associated with Visualforce pages through the controller attribute.
    • Custom controller defines its own functionality.
    • 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.
    • You’d use this when your page isn’t dealing with a main object.
    • This reply was modified 5 years, 4 months ago by  Nikita.
  • Saddam

    Member
    August 19, 2019 at 12:42 pm

    Hi Piyush,

    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.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos