https://sforce.co/3dsLQ6N
http://alturl.com/qvfzo
http://gg.gg/x5rqv
http://inx.lv/pQAu
https://is.gd/PBUaIz
http://tinylink.in/bj8on
Hi
Try the following it will be user friendly
Map<String,Id> recordtypeMap = new Map<String,Id>();
for(Record Type leadRT : [select id, Name from RecordType where SObjectType = 'Lead' ]){
recordtypeMap.put(leadRT.Name,leadRT.Id);
}
//you can create lead by following
Lead l = new Lead(firstname='testInsertLead2', lastname='test',company='Temp Company', RecordTypeId = recordtypeMap.get('registration type lead'));
// be sure to enter record type name correctly other wise it would give an error.
Thank you,
Choose it as Best Answer if it resolved your issue.