I've started to notice that the RecordType table isn't handling limits correctly, but only in Test Classes.

If I run [SELECT Id FROM RecordType], there are a bunch of results. But If I run [SELECT Id FROM RecordType LIMIT 1], the result is null.

Through some trial and error I discovered that it appears to be off by 2, meaning that if I run [SELECT Id FROM RecordType LIMIT 3], I'll get one result back instead of 3 even though there are way more than 3 when I ran the query without the limit.

This appears to have started recently, but I can't seem to find anything that could have caused this change. Is there something that I'm missing or some other way to fix it other than setting the limit to 3?

  • I'm unable to replicate this issue. You might want to contact Support and see what they have to say; it may be specific to your org.
    – sfdcfox
    Feb 26, 2022 at 5:12
  • I'm seeing this on a Partner Dev Org, when issuing the SOQL in the Developer Console. I created two record types, and see both when I don't use a limit, when I set it to limit 1 I get zero results, but like you when I set it to limit 3 I get one result. Very curious.
    – edralph
    Feb 26, 2022 at 12:44

1 Answer 1


This is a known Salesforce bug.

  • Should I post such information as a proper answer (as I've done here) or is a comment to the original question a better place?! Feb 27, 2022 at 9:22
  • Interesting, it just started happening in my orgs recently.
    – aaron
    Feb 27, 2022 at 18:39
  • Let me first of all state that I found this answer only by searching online (+some luck). I'm in no way an expert regarding this curious phenomenon ;-) One explanation for your case could obviously be that your profile access to objects has changed recently (but you might have thought of this already). Another explanation - that your org was not affected; from past experience I got the impression that Salesforce's list under "Is it fixed?" is a bit unreliable. (I assume the hosting machine of your org hasn't changed?! Probably not very probable.) Feb 27, 2022 at 20:10

You must log in to answer this question.

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