function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rajeev_BangRajeev_Bang 

get record type without soql on recordtype in apex

How to find record type id from without soql in aprx?
Vijay NagarathinamVijay Nagarathinam
Hi Rajeev,

Refer the below blog,

http://manojjena20.blogspot.in/2015/08/how-to-get-recordtypeid-in-apex-without.html

Thanks,
Vijay
Gaurav_SrivastavaGaurav_Srivastava
Hi Rajeev,

Try below sample code. Here API Name of object is "CustomObject__c" and object name is "CustomObject".
Id objectRecordTypeId = Schema.SObjectType.CustomObject__c.getRecordTypeInfosByName().get('CustomObject').getRecordTypeId();

Thanks,
Gaurav