Tuesday, 14 February 2017

APEX Get Record Type Details for specific object based on record type name



Below code will fetch the record type details for specific object based on record type name using APEX code

Schema.DescribeSObjectResult R = Account.SObjectType.getDescribe();

Map<String,Schema.RecordTypeInfo> rtMapByName = R.getRecordTypeInfosByName();

Schema.RecordTypeInfo rtInfo = rtMapByName.get('MyAccounts');

System.debug(rtInfo.getRecordTypeId());



No comments:

Post a Comment