function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
brainsharkbrainshark 

How to join 2 objects?

This is probably easy but I can't quite figure out how to do it...
 
I'm trying to execute a search on an object... Say, Account. And I want to return Account Name, and Account Owner's Name.
 
The Account has a lookup field (OwnerId) but I really want to return the Name of that User. It seems to me that I would want to somehow join Account and User objects.
 
Is there a way to do that in SOSL? SOQL?
 
An example would be great.
 
Thanks
Mike LeachMike Leach
JOIN is not supported. The Lookup fields are quite literally for "looking up" foreign object references.

The API only allows for querying a subset of Accounts, then retrieving the User object based on OwnerId to display the Owner Name.