PDI · Question #4
A developer Is asked to create a Visualforce page that lists the contacts owned by the current user. This component will be embedded In a Lightning page. Without writing unnecessary code, which…
The correct answer is B. Standard controller. The developer needs a Visualforce page to list contacts owned by the current user, to be embedded in a Lightning page, without writing unnecessary custom code.
Question
A developer Is asked to create a Visualforce page that lists the contacts owned by the current user. This component will be embedded In a Lightning page. Without writing unnecessary code, which controller should be used for this purpose?
Options
- AStandard list controller
- BStandard controller
- CLightning controller
- DCustom controller
How the community answered
(40 responses)- A10% (4)
- B83% (33)
- C5% (2)
- D3% (1)
Why each option
The developer needs a Visualforce page to list contacts owned by the current user, to be embedded in a Lightning page, without writing unnecessary custom code.
A 'Standard list controller' (i.e., `StandardSetController`) typically requires custom Apex code to implement dynamic filtering like 'owned by the current user' unless a specific list view is referenced, which goes against the 'without writing unnecessary code' constraint.
A Visualforce page can use a standard controller for the User object and then leverage the `<apex:relatedList>` component to display contact records where the User is the owner, effectively listing contacts owned by the current user without custom Apex code.
A Lightning controller is used for Lightning Web Components or Aura Components, not for Visualforce pages.
A custom controller would require writing Apex code to query and filter the contacts, which the question explicitly seeks to avoid.
Concept tested: Visualforce Standard Controller with Related Lists
Source: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_standard_controller_about.htm
Topics
Community Discussion
No community discussion yet for this question.