There is a new method for Schema in Winter 14 called Schema.describeSObjects. The idea as I understand the docs is that you can pass in a list of sObject names as strings, and get back the describe results for each of them in a list of results. But it doesn't seem to working as I would expect, but maybe I am just missing something obvious...

As I understand it, these calls should return the same information. The new method returns the basic info, but when I request the recordtypeinfo, I get back null...

Schema.DescribeSObjectResult r = Account.sObjectType.getDescribe();
system.debug(r); //Returns basic describe info 
system.debug(r.getRecordTypeInfosByName()); //Returns all the record types

String[] types = new String[]{'Account'};
List<Schema.DescribeSobjectResult> results = Schema.describeSObjects(types);
system.debug(results); //Returns the same basic describe info
system.debug(results[0].getRecordTypeInfosByName()); //**returns null**
  • 1
    Not sure what is going on there. Oddly, .getRecordTypeInfos() seems to work fine. You could use that to rebuild the Map if required. Oct 16, 2013 at 1:21
  • That is unexpected, both getRecordTypeInfosById() and getRecordTypeInfosByName() doesn't work but getRecordTypeInfos does. There is nothing seems to be missed in sample code.
    – Ashwani
    Oct 16, 2013 at 6:22
  • Yep, most odd, i performed the same checks as @reddev and scanned the docs for any hint of a limitation comment and found nothing, thus concluding.... you've found a platform bug. I'd also agree with Daniel about the workaround in the meantime. Oct 16, 2013 at 8:17
  • Ok - thanks to everyone for the sanity check - let me see what Developer Support has to say on this issue.. Oct 16, 2013 at 16:04
  • Heard back from dev support...they ran our code and confirmed we are right...and offered Daniel's solution as the workaround...I'll update again in support hears more from R&D Oct 24, 2013 at 20:47

1 Answer 1


So support confirmed that this was happening, but I don't see it in Known Issues, so I guess it it a limitation for now - I'll raise an idea and see what happens. For now though, you can follow Daniel's suggestion and build your own map:

String[] types = new String[]{'Account'};
List<Schema.DescribeSobjectResult> results = Schema.describeSObjects(types);
Map<String, Schema.RecordTypeInfo> rmap = new Map<String, Schema.RecordTypeInfo> ();

for (Schema.RecordTypeInfo ri: results[0].getRecordTypeInfos()) {
        rmap.put(ri.getname(), ri);//use ri.getRecordTypeId() for an Id map 

You must log in to answer this question.

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