User Story
Get the record type with the name Student from Contact Object.
Solution
String recordTypeName = 'Student';
String objectTypeName = 'Contact';
List<RecordType> recordTypes = [SELECT Id, Name
FROM RecordType
WHERE SObjectType = :objectTypeName
AND Name = :recordTypeName
LIMIT 1];
if (!recordTypes.isEmpty()) {
RecordType studentRecordType = recordTypes[0];
System.debug('Student Record Type ID: ' + studentRecordType.Id);
} else {
System.debug('No record type with the name "Student" found for Contacts.');
}
Video
Video does not exists.