In this example, I am getting Account object default record type Id
Example
Result
Example
Schema.DescribeSObjectResult describeResult = Account.getsObjectType().getDescribe();
List<Schema.RecordTypeInfo> rtInfos = describeResult.getRecordTypeInfos();
for(Schema.RecordTypeInfo rtInfo : rtInfos) {
if(rtInfo.isDefaultRecordTypeMapping()) {
System.debug('Default Record Type Id ====> '+rtInfo.getRecordTypeId());
}
}
Result
How to make it dynamic
ReplyDelete