I have a custom object called 'Intake_New__c' that has a lookup field to an Account object called 'Third_party__c'.

enter image description here

The account object 'Third_party__c' has a Hierarchy field on it called 'Parent Third Party'

enter image description here

Here is the detail of that field:

enter image description here

Now I am trying to get name of the related account's parent name so I can display in an email template like:


And it is not working.

I tried to do a query as follows in the console to see:

enter image description here

And I am seeing that it is returning [object object] instead of the Name. I need the actual name. Also please note that the resultset header says 'third_party__r.parent' and not 'third_party__r.parent.name'

What am I doing wrong?

UPDATE**: So per a suggesstion below I went and tried to do some debugging in debug console and still do not get why I am not seeing the Account Name in my debug statements.

List<Intake_New__c> thirdPartyData = [SELECT Third_Party__r.Parent.Name FROM Intake_New__c WHERE Third_Party__r.Parent.Name<>null LIMIT 100 ];


17:16:58:058 USER_DEBUG [4]|DEBUG|(Intake_New__c:{Third_Party__c=001E0000015hChYIAU, Id=a4k2S000000LWBKQA4}, Intake_New__c:{Third_Party__c=001E0000015hChYIAU, Id=a4k44000000Cr3oAAC}, Intake_New__c:{Third_Party__c=001E0000015hChYIAU, Id=a4k44000000Cr3pAAC}, Intake_New__c:{Third_Party__c=001E0000015hChYIAU, Id=a4k44000000CsO9AAK}, Intake_New__c:{Third_Party__c=001E0000015hChYIAU, Id=a4k44000000CsOQAA0}, Intake_New__c:{Third_Party__c=001E0000015hChYIAU, Id=a4k44000000CsOpAAK}, Intake_New__c:{Third_Party__c=001E0000015hChYIAU, Id=a4k4

1 Answer 1


As stated in the other answer, the Developer Console has this problem because of a limitation in design. If you really just want a quick-and-dirty query, you can alias an aggregate query, this has a 2000 row maximum, but will return values even from far away.

SELECT Third_Party__r.Parent.Name 
FROM Intake_New__c 
WHERE Third_Party__r.ParentId <> null 
GROUP BY Third_Party__r.Parent.Name 

To get a proper debug statement in Apex, serialize the results of the query:


The default debug statement only outputs fields, not relationships (both parent and child).

  • Also to note is if you use network monitoring (e.g. in dev tools in Chrome) you can actually see the data, it's just a rendering problem in Developer Console, because the API serializes that relationship.Name as relationship: { Name: value } to highlight that this is actually a property of another object
    – zaitsman
    Commented Jun 30, 2020 at 23:47
  • 1
    @zaitsman Yeah, I'm aware of that. It's a kind of silly bug, but it's been like this ever since the console was introduced. I heard they have a bug logged against it, but no idea when we'll get it.
    – sfdcfox
    Commented Jun 30, 2020 at 23:56
  • doubt if we ever will judging by salesforce.com/company/news-press/stories/2020/6/…
    – zaitsman
    Commented Jun 30, 2020 at 23:58
  • 1
    @zaitsman I won't speculate on that, but I don't think it's impossible. The Developer Console still has features that VS Code doesn't, and there's no clear communication about when we'll have feature parity.
    – sfdcfox
    Commented Jul 1, 2020 at 1:00

You must log in to answer this question.

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