Salesforce Certified Platform Developer II — Question 178
A developer writes a Lightning web component that displays a dropdown list of all custom objects in the org from which a user will select. An Apex method prepares and returns data to the component.
What should the developer do to determine which objects to include in the response?
Answer options
- A. Check the getObiectType() value for ‘Custom’ or ‘Standard’ on the sObject describe result.
- B. Import the list of all custom objects from @salesforce/schema.
- C. Use the getCustomObjects() method from the Schema class.
- D. Check the isCustom() value on the sObject describe result.
Correct answer: C
Explanation
The correct answer is C because the getCustomObjects() method from the Schema class is specifically designed to retrieve custom object metadata. Option A is incorrect as getObiectType() does not directly filter for custom objects, B does not provide a dynamic approach, and D checks if an object is custom but does not fetch the list of custom objects directly.