How do I use an extension controller in Salesforce?

How do I use an extension controller in Salesforce?

Controller extension in Salesforce is an Apex class containing a constructor that is used to add or extend the functionalities of a Standard Controller or custom controller in Salesforce. Extension controller is also used to leverage the functionality of another controller using our own custom logic.

What is controller in VF page?

How a Controller is used in Visualforce pages ? Controllers are those who provide business logic to Visualforce pages. It accepts data from user like input values. Controller manipulates user’s input and performs action on behalf of the User. Manipulated User’s data is redirected to browser as a new page.

What can you do with a Visualforce controller?

Controllers typically retrieve the data to be displayed in a Visualforce page, and contain code that executes in response to page actions, such as a button being clicked. When you use the standard controller, a great deal of, well, standard functionality is provided for you by the platform.

When should you use a controller extension?

Use controller extensions when:

  1. 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.
  2. You want to add new actions.
  3. You want to build a Visualforce page that respects user permissions.

What does an extension do for a controller?

Controller extensions allow you to extend any controller’s (Standard and Custom) functionality and allows you to consolidate said functionality by extension, since you can have more than one extension for a selected Custom or Standard controller.

What do you mean by controller extension in Salesforce?

Controller extension in Salesforce is an Apex class containing a constructor that is used to add or extend the functionalities of a Standard Controller or custom controller in Salesforce.

Which is an example of an apex controller?

A controller extension is any Apex class containing a constructor that takes a single argument of type ApexPages.StandardController or CustomControllerName, where ExtensionController is the name of a custom controller in this example. {!greeting} expression references the getGreeting method in extension controller.

What is the purpose of a custom controller?

The Custom controller… The Custom Controller, is one that is used to inherit the Standard Controller’s functionality, whilst allowing to get access to extra information, like: Access data that is not available with a Standard Controller, like more than one level down child or related objects.