Salesforce Certified Platform Developer II — Question 126

A developer wants to create a Visualforce page that allows a user to search for a given account by Name. If the account is found, the account details should be populated on screen. If no account is found, an error message should be displayed to the user.
How can this be accomplished? (Choose two.)

Answer options

Correct answer: B, C

Explanation

The correct choices are B and C because ApexPages.addMessage() allows you to programmatically add messages to the page, while <apex:pageMessages> is specifically designed to display those messages to the user. Option A is incorrect as (apex: information) is not suitable for error messages, and option D is inappropriate as account.addError() is used for validation errors on fields, not for general messages.