I'm trying to access a grandparent record through a SOQL query and am having some trouble. From my understanding, you can go 5 levels deep with a child-to-parent relationship in a query, so I don't know why this isn't working.
For this example, child__c has a lookup to parent__c and parent__c has a lookup to grandparent__c.
Child__c dbRecord = [
SELECT
Id,
Parent__r.Name,
Parent__r.Grandparent__c,
FROM
Child__c
WHERE
Id = :childId
];
what's odd is that I'm running this in the dev console and while it isn't throwing an error, the value of "Grandparent__c" is never populated as if it wasn't in the query at all.
Any ideas or am I misunderstanding the SOQL child-to-parent relationship somehow?