nerdexam
Salesforce

PDI · Question #218

Consider the following code snippet for a Visualforce page that is launched using a Custom Button on the Account detail page layout. When the Save button is pressed the developer must perform a…

The correct answer is B. Controller extension. A controller extension is the most appropriate solution as it allows for adding custom business logic, such as complex multi-object validations and custom redirects, while still leveraging the standard controller's functionality for a Visualforce page.

Submitted by ravi_2018· Apr 18, 2026User Interface

Question

Consider the following code snippet for a Visualforce page that is launched using a Custom Button on the Account detail page layout. When the Save button is pressed the developer must perform a complex validation that involves multiple objects and, upon success, redirect the user to another Visualforce page. What can the developer use to meet this business requirement?

Exhibit

PDI question #218 exhibit

Options

  • ACustom controller
  • BController extension
  • CValidation rule
  • DApex trigger

How the community answered

(24 responses)
  • A
    4% (1)
  • B
    71% (17)
  • C
    17% (4)
  • D
    8% (2)

Why each option

A controller extension is the most appropriate solution as it allows for adding custom business logic, such as complex multi-object validations and custom redirects, while still leveraging the standard controller's functionality for a Visualforce page.

ACustom controller

A custom controller completely replaces the standard controller, meaning the developer would have to reimplement all standard save/cancel behavior, which is usually more work than extending existing functionality.

BController extensionCorrect

A controller extension allows a developer to augment the functionality of a standard or custom controller without replacing it, enabling the addition of complex validation logic involving multiple objects and custom navigation or redirection upon successful processing, directly from the Visualforce page's save action.

CValidation rule

Validation rules provide declarative validation for single objects and cannot handle complex multi-object validation or custom redirection logic directly from a Visualforce page's controller action.

DApex trigger

An Apex trigger executes automatically before or after DML operations on records; it is designed for backend data manipulation and validation, not for controlling Visualforce page flow, complex multi-object validation directly tied to a page's save action, or page redirection.

Concept tested: Visualforce controller extensions

Source: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_extensions.htm

Topics

#Visualforce#Controller Extension#Validation#Page Navigation

Community Discussion

No community discussion yet for this question.

Full PDI Practice