Salesforce Platform Developer I (legacy) — Question 127
A developer is asked to create a Visualforce page that displays some Account fields as well as fields configured on the page layout for related Contacts.
How should the developer implement this request?
Answer options
- A. Use the <apex:include> tag.
- B. Use the <apex:relatedList> tag.
- C. Add a method to the standard controller.
- D. Create a controller extension.
Correct answer: B
Explanation
The correct answer is B, as the <apex:relatedList> tag is specifically designed to display related records in Visualforce pages, such as Contacts related to an Account. The other options do not provide the necessary functionality to display related records effectively; <apex:include> is for including other Visualforce pages, while adding a method to the standard controller or creating a controller extension would not directly achieve the requirement of showing related lists.