Another Salesforce blog!!!

Salesforce, Apex

How to get RecordType Id

/To get the recordType Id for Account – Record Type Name is “Person Account”
//Get all the Record Types of Account and store it in a map.
Map <String,Schema.RecordTypeInfo> recordTypes = Account.sObjectType.getDescribe().getRecordTypeInfosByName();
//Get the record type id of from the Map based on the Name
Id RecTypeId = recordTypes.get('Person Account').getRecordTypeId());

Leave a Reply

Your email address will not be published. Required fields are marked *