Get all record types available on sObject in APEX Get all record types available on sObject in APEX Post author:Swapnil Jaiswal Post published:August 15, 2022 Post category:Blog / Salesforce Post comments:0 Comments Suppose that you want to get all record types of any standard or custom object in APEX class , here is the simplest way to solve your problem. I have created two record types on Contact Object , Master is the default record type available on every Object. Get All record Type Here we are using Schema class to find record type , the below code will return all Standard and Custom record types available on Contact Object. Schema.DescribeSObjectResult describe =Schema.getGlobalDescribe().get('Contact').getDescribe(); Schema.RecordTypeInfo defaultRecordType; for(Schema.RecordTypeInfo recordType : describe.getRecordTypeInfos()) { System.debug( recordType.getDeveloperName()); } Get only Custom Record types Given code help you to find all Custom record types of Contact Object . Schema.DescribeSObjectResult describe =Schema.getGlobalDescribe().get('Contact').getDescribe(); Schema.RecordTypeInfo defaultRecordType; for(Schema.RecordTypeInfo recordType : describe.getRecordTypeInfos()) { if(recordType.isDefaultRecordTypeMapping()) { System.debug( recordType.getDeveloperName()); } } Get Id of record type To get the Id of record type use getRecordTypeId() method . System.debug( recordType.getDeveloperName()); I hope this blog help you to learn something new . Please share with your Coders friends , don’t forget to subscribe our Youtube channal. You Might Also Like Uncaught (in promise) TypeError: e.map is not a function in LWC. February 9, 2022 Update related Account field on creating new Contact December 12, 2022 Allow to enter only number in lighting-input field May 4, 2022 Leave a Reply Cancel replyCommentEnter your name or username to comment Enter your email address to comment Enter your website URL (optional) Save my name, email, and website in this browser for the next time I comment.