-2

I want to obtain record type info like:

List<RecordType> lstrecord = new List<RecordType>([Select id,Name from RecordType where sObjectType = 'Move__c' and Name = 'Draft' ]);

using schema

2
  • Hi and welcome to SFSE. Could you please take a bit of time to read How to Ask then edit your question to clarify what you are asking and to explain what you already tried? – Phil W Jan 23 '20 at 8:27
  • I need to convert List lstrecord = new List([Select id,Name from RecordType where sObjectType = 'Move__c' and Name = 'Draft' ]); into schema class – maulik makku Jan 23 '20 at 9:38
1

For your specific object you can use:

Schema.RecordtypeInfo devRecordTypeId = Schema.SObjectType.Move__c.getRecordTypeInfosByName().get('Draft');
4
  • List<RecordType> lstrecordId = [Select Name, Id From RecordType where sObjectType='Move__c' and isActive=true LIMIT 1]; – maulik makku Jan 23 '20 at 10:08
  • Can you explain what you mean please? – J.Dillinger Jan 23 '20 at 10:11
  • I want To Get Sobject Record Type Id By Record Type Name Without Soql – maulik makku Jan 23 '20 at 10:23
  • Just see the code above. If you need the Id only you can write: Id devRecordTypeId = Schema.SObjectType.Move__c.getRecordTypeInfosByName().get('Draft').getRecordTypeId(); – J.Dillinger Jan 23 '20 at 10:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.