When would a developer use a custom controller instead of a - ProProfs Discuss
Topics
Products
Follow Us:

When would a developer use a custom controller instead of a controller extension?

When would a developer use a custom controller instead of a controller extension?

Change Image    Delete



A. When a Visualforce page needs to replace the functionality of a standard controller.
B. When a Visualforce page does not reference a single primary object.
C. When a Visualforce page should not enforce permissions or field-level security.
D. When a Visualforce page needs to add new actions to a standard controller.

This question is part of Platform 1c
Asked by Kevindotcar, Last updated: Jul 07, 2020

+ Answer
Request

2 Answers

dimaprish

Dimaprish

Answered Apr 18, 2017

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. 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.

 

John Smith

John Smith

Answered Jan 18, 2017

When a Visualforce page needs to replace the functionality of a standard controller.
When a Visualforce page should not enforce permissions or field-level security.
 

Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer

Email Sent
We have sent an email to your address "" with instructions to reset your password.