0

I am trying to query and get the record type of the child record of a Parent record.

I amusing the below code but I in the result of record name I get [Object Object] only. Why does the name of the record type is not displayed

Query:

select id,Chil_relationshipName__r.Name,Chil_relationshipName__r.RecordType.Name from parentObject__c

In the record type column I get - [Object Object] instead of the name of the record type.

3
  • Found the dupe. Minor variations on this question have been asked many times already on SFSE.
    – Adrian Larson
    Apr 10, 2017 at 19:26
  • Also your syntax indicates it's a parent record, not a child.
    – Adrian Larson
    Apr 10, 2017 at 19:27
  • You are right! my bad
    – SfdcBat
    Apr 10, 2017 at 20:30

1 Answer 1

2

That's just how the developer console displays results when you traverse more than one level of relationship. If you want to see the results, you have to use a different tool, such as Apex. For example, you'd see the values using Execute Anonymous:

for (MyObject__c record : [/*query*/])
{
    system.debug(record.Parent__r.Grandparent__r.Field__c);
}
2
  • Thank you! I hope when I use the recordtype.name in an apex code it would not show [object object]
    – SfdcBat
    Apr 10, 2017 at 20:25
  • 1
    No, Apex will not suffer any such limitation.
    – Adrian Larson
    Apr 10, 2017 at 20:31

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