CRT-450 Exam QuestionsBrowse all questions from this exam

CRT-450 Exam - Question 207


A developer is creating a page that allows users to create multiple Opportunities. The developer is asked to verify the current user’s default Opportunity record type, and set certain default values based on the record type before inserting the record.

How can the developer find the current user’s default record type?

Show Answer
Correct Answer: D

In order to find the current user’s default Opportunity record type, the developer can use the Opportunity.SObjectType.getDescribe().getRecordTypeInfos() method. This method provides a list of RecordTypeInfo objects for the Opportunity sObject. The developer can iterate through these objects and use the isDefaultRecordTypeMapping() method to determine which record type is the default for the current user. This approach ensures that the default record type is correctly identified based on the user's settings.

Discussion

3 comments
Sign in to comment
irina_735Option: D
Sep 15, 2023

https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_RecordTypeInfo.htm#apex_Schema_RecordTypeInfo_isDefaultRecordTypeMapping

DonAldosOption: A
Mar 30, 2023

To find the current user’s default record type, you can use the getDefaultRecordType() method from the Schema.UserInfo class, which returns the default record type ID for the specified object and user. In this case, you would use Schema.UserInfo.Opportunity.getDefaultRecordType() to get the default record type ID for Opportunities.

vancika
Apr 1, 2023

There's no such class as Schema.UserInfo. Correct Answer is D

irina_735
Sep 15, 2023

UserInfo class is in System namespace. There is no Schema.UserInfo class.

aregasOption: D
May 30, 2024

D) RecordTypeInfo Class Contains methods for accessing record type information for an sObject with associated record types. - isDefaultRecordTypeMapping() Returns true if this is the default record type for the user, false otherwise. https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_RecordTypeInfo.htm#apex_Schema_RecordTypeInfo_isDefaultRecordTypeMapping