Is there a way to get the Name from the OwnerId and Account__r.OwnerId in this query?

Select Id, Name, OwnerId,Account__r.Name, Account__r.OwnerId from Sede_BU__C WHERE RecordtypeId = '01224000000B3JL'



1 Answer 1


You can access the name of the owner using Owner as the name of the relationship between the objects.

Owner.Name, Account__r.Owner.Name
  • 1
    the query gets through, but as a result i see : [object Object] .
    – nerti__h
    Apr 11, 2017 at 8:36
  • It sounds like you are doing the query in javascript and what you are seeing is the toString() method is being applied to the object with the query results. When you are using the object, make sure the object isn't getting converted to a string. For example, if you are just logging the value, instead of logging results with a plus sign console.log("result" + result), use a comma instead: console.log("result",result)
    – martin
    Apr 11, 2017 at 8:40
  • no problem‌​​​​​​​​​​​​​​​​​​​​​​​​​​​​‍​​​​​​​​​​​​​​​​​​​​​​​​​​​​‍​​​​​​​​​​​​​​​​​​​​​​​​​​​​‍​​​​​​​​​​​​​​​​​​​​​​​​​​​​‍​​​​​​​​​​​​​​​​​​​​​​​​​​​​‍
    – martin
    Apr 11, 2017 at 8:58

You must log in to answer this question.

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