function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Robert RobinsonRobert Robinson 

Displaying Record Type ID name in SOQL query

I am running a SOQL query. In it, I want to display the name of the Record Type rather than the ID number. If I create a query that includes:
Select .... RecordTypeID, I get the record type ID; however, when I use "RecordTypeID.name" or "RecordTypeID__r.name", I get this error:

ERROR at Row:1:Column:121
Didn't understand relationship 'RecordTypeID__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.


I have the feeling that the Record Type name has different properties, but I am not using the correct syntax to display the name. What am I missing. Thanks. 
Best Answer chosen by Robert Robinson
EllieAtWHLEllieAtWHL
Hi Robert,

Try using RecordType.Name in the SOQL query. As iti s a standard relationship you do not need __r.

All Answers

EllieAtWHLEllieAtWHL
Hi Robert,

Try using RecordType.Name in the SOQL query. As iti s a standard relationship you do not need __r.
This was selected as the best answer
Robert RobinsonRobert Robinson
Please somebody, just shoot me. As you can see from my question, I included the "ID" (RecordTypeID.Name). Augh! Thanks, Ellie, for making me look at this again...
Buddy ZapataBuddy Zapata
Robert I did the same thing. Odd, "RecordType" doesn't show up as an option even when choosing to "insert a field" for a formula for a custom field. RecordType.Name worked great though.