My non-profit has an event every Sunday. I'm looking to build a VF page where volunteers can check people in. The first thing the volunteer should see is a search screen that will look for the contact in Salesforce. When a contact is found they have another screen that offers them different prices depending on fields from the contact record. Afterwards a transaction record should be created.

So my question is about how the visualforce pages and controllers should exist. Is it better to have one vf page that renders different parts after a contact is selected, or is it better to have two pages and pass values between them? I believe either way I would just have one controller, but what type? I think it can't be a standard controller for contacts or transactions. But maybe it could be a standard controller for one and an extension for the other. Or maybe it needs to be a custom controller that somehow looks at both of them. There are a bunch of different ways to do this, but I'm wondering what the pros and cons of doing it each way might be.

1 Answer 1


First of all, only StandardController will not serve your purpose.

So, go for StandardController will ControllerExtension, which means it will extend the functionalities of StandardController (will run in user mode) and it will perform some extra action which cannot be possible through StandardController itself. The look & feel of tabs, pagelayouts automatically take which you have already defined in configuration.

CustomController is not needed in this scenario. But if you think, the look and feel and visibility & sharing will be based on the logic on the controller then you can go for Custom one.

Regarding number of Visualforce pages, it will truly depend on the complexity of the pages. For less complex and minimal data display in VFP, you can club 2 pages into one, otherwise you can develop 2 pages.

In your case, one ControllerExtension will serve for both the VFP.

So, finally,

What are Custom Controllers and Controller Extensions?

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .