-1
public static map<id,RecordType> MapRecordtype = new Map<id,RecordType>([SELECT id, DeveloperName FROM RecordType where sobjecttype ='move__c' and 
                                       Developername in('Assignment','Draft','Domestic_Draft','LTST_Draft','MX_Domestic','MX_Domestic_draft','Termination','International_Relo','Localization','J1',
                                       'Back_To_Back','Repatriation','PAM','US_Domestic_Relo','CHN_Domestic_Relo','CHN_Domestic_Draft')])

Can we write schema for above query?

1
  • Please do not repost questions that are essentially identical. I have closed the previous one as a duplicate of this one, as it contains a little bit more information. – David Reed Jan 23 '20 at 15:38
3

You need to have a look into getRecordTypeInfosByDeveloperName

Here is the sample code that fetche recordTypeId for account, where developer name of recordtype is Broker.

Map<String, Schema.RecordTypeInfo> developerNameVsRecordTypeInfos = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName();
System.debug(developerNameVsRecordTypeInfos.get('Broker').getRecordTypeId());

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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