I have the following block of code and when i execute it from the developer console using anonymous window it is working fine without any error, But it's strange when i copy the same thing in apex class it is giving an compilation error.

Map<Id, Schema.RecordTypeInfo> recordTypeByIdMap = Schema.SObjectType.Contact.getRecordTypeInfosById();
Map<String,String> conversionMap = new Map<String,String>();
for(String r:recordTypeByIdMap.keySet())

And here is the error I am getting after copying same code the apex class:

"Method does not exist or incorrect signature: void getDeveloperName() from the type Schema.RecordTypeInfo"

Let me know anyone else has faced the same error or someone can give some feasible solution.

  • 4
    what is an API version of the class ? Jul 18, 2018 at 7:07
  • ... i.e. change the API version for the class to 43.0 as this is a recent addition.
    – Keith C
    Jul 18, 2018 at 7:11

1 Answer 1


In order to have getDeveloperName() method available, API version of the class should be 43.0 for now.

Check Summer '18 release notes

Schema.RecordTypeInfo Class

New Method


Returns the developer name for this record type.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .