Salesforce Platform Developer I (legacy) — Question 35
A developer wants to display all of the picklist entries for the Opportunity StageName field and all of the available record types for the Opportunity object on a
Visualforce page.
Which two actions should the developer perform to get the available picklist values and record types in the controller? (Choose two.)
Answer options
- A. Use Schema.RecordTypeInfo returned by Opportunity.SObjectType.getDescribe().getRecordTypeInfos().
- B. Use Schema.PicklistEntry returned by Opportunity.SObjectType.getDescribe().getPicklistValues ().
- C. Use Schema.RecordTypeInfo returned by RecordType.SObjectType.getDescribe().getRecordTypeInfos().
- D. Use Schema.PicklistEntry returned by Opportunity.StageName.getDescribe().getPicklistValues ().
Correct answer: A, D
Explanation
The correct answers are A and D. Option A correctly retrieves record type information for the Opportunity object, while Option D retrieves the picklist values specifically for the StageName field. Options B and C are incorrect because they either do not pertain specifically to the Opportunity object or the StageName field.