Salesforce Platform Developer I (legacy) — Question 37
An org has a data model with a Buyer__c object that has a lookup relationship to Region__c and a Supplier__c object has a lookup relationship to Region___c.
How can a developer display data from the related Supplier__c records on a Visualforce page that has a standard controller for the Buyer__c object?
Answer options
- A. Use rollup formula fields on the Buyer__c object to reference the related Supplier__c records through the Region__c.
- B. Use SOQL in a controller extension to query for related Supplier__c records.
- C. Use a second standard controller for the Region__c object on a page to display the related Supplier__c records.
- D. Use merge field syntax to retrieve the Supplier__c records related to the Buyer__c record through the Region__c.
Correct answer: B
Explanation
The correct answer is B because using SOQL in a controller extension allows for custom queries to retrieve related Supplier__c records based on the Region__c lookup from Buyer__c. The other options either do not provide a direct way to access the related records or are not applicable in the context of a standard controller setup.