0

I want to query the Case Record Type Name for the Parent Case of an Email Message. I am trying with the below query but it is not returning me the name :-

select id,subject,parentid,parent.recordtypeid,parent.recordtype.name
   from emailmessage where id = 'xxx...xxx'

I am able to get the Record Type ID but not the name. In the name column, it is returning me [object Object]. Please advise if there is any way to do this.

Thanks, Alex.

1 Answer 1

1

That's just an artifact of using the developer console.

If you use anonymous apex to run that query, and system.debug(myEmailMessage.Parent.RecordType.Name); (system.debug doesn't print nested objects, or does so very minimally) or system.debug(JSON.serialize(myEmailMessage));, you'll see that you do in fact get the data you requested in your query.

2
  • Can you please advise how to use that in a SOQL?
    – SFDC Alex
    Nov 3, 2020 at 15:36
  • @SFDCAlex That request doesn't make any sense to me. The examples I gave simply use the result that you would get from a query.
    – Derek F
    Nov 3, 2020 at 16:08

You must log in to answer this question.

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