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
jdenningjdenning 

Accessing fields based on Id

Is it possible to access fields of another object based on just an ID?  For instance, through SOQL i get a list of opportunity IDs with owner IDs.  Can I get to User fields like department, division, etc. using just the owner ID without needing another SOQL query?

Best Answer chosen by Admin (Salesforce Developers) 
dnakonidnakoni

Usually you can do [select Id, Owner.Name, Owner.IsActive from Opportunity]

 

Hope that helps.