All Ideas

Idea Details

Post an Idea
This idea has been merged into another idea. To comment or vote on this idea, please visit Ability to query RecordType.Name rather than RecordTypeId in SOQL.
0  Points voting closed

Ability to query RecordType.Name in SOQL instead of using a nested query to get

Campaigns & Leads

We would like to have the ability to query RecordType.Name in SOQL very much we do with the other objects, instead of using a nested query to get the Id first. Nested queries count against the total number of queries in a transaction and sometimes it is important to keep track of all nested queries.

Currently we get an UNKNOWN ERROR when querying the RecordType.Name in SOQL in a query that grabs CampaignMembers. Although this is not clearly mentioned in any documentation, Salesforce mentioned that using the RecordType.Name in SOQL is not supported and we should use a nested query to get the Id instead.

So, instead of:
        SELECT ... FROM CampaignMember WHERE RecordType.Name = 'ABC'

To use:
        SELECT ... FROM CampaignMembers WHERE RecordTypeId in (SELECT Id FROM RecordType WHERE Name = 'ABC')
We would like this to be fixed and supported and be able to query any object based on the RecordType.Name.


· Flag

  • Upvotes
  • Downvotes



from AppExchange


Help us to keep IdeaExchange clean by pointing out overlapping ideas. We'll investigate your suggestion and merge the ideas if it makes sense.



Thanks for your merge suggestion. We will review it shortly and merge the ideas if applicable.

Salesforce takes abuse situations very seriously. Examples of abuse include but are not limited to posting of offensive language or fraudulent statements. To help us process your request as quickly as possible, please fill out the form below describing the situation. For privacy and security reasons, the final outcome of an abuse case may not be revealed to the person who reported it.


Thank you for your feedback. We take abuse seriously and will investigate this issue and take appropriate action.