1

There were one time that I was trying to get the Owner name from Case. I searched online and knew that I can use the following query to achieve:

Select Id, AccountId, Owner.Name, Owner.Email, Owner.Username, Owner.title from Case

I would like to know that where's this Owner coming from? I don't see there's a Owner object and I believe that Owner.Name was getting from User object. However, how do I know what other data I can retrieve by using Owner.xxx?

Thanks

1

3 Answers 3

6

So yes, typically Owner relates to the User obj, BUT it can also relate to the Group obj. There are a number of standard objects that have multiple Objects off Owner (kinda of like the WhatId or WhoId on task) for instance a Case can belong to a queue (Group) and so Owner.Email would be invalid. Task can also belong to a Queue (Group). If you look in the Schema browser, you can see what Objects owner ties to. You can also use the OwnerId.getSobjectType() to see what it ties to.

enter image description here

2
  • Oh yes, totally forgot about groups! Commented Jan 28, 2014 at 19:46
  • :-) its the silent killer of all queries :-P i had an issue with it not to long ago off Owner. I thought i was going mad, and then realized it was because group didnt have email! Commented Jan 28, 2014 at 19:48
2

Owner is basically the relationship name for a lookupfield to the User object. Many standard objects come with this.

As through any relationship, you can query for all fields on the other side up to a few levels of dept.

1

Owner is User Object.You can view the list of fields through force.com explorer or schema builder in salesforce IDE(force.com plugin)

You must log in to answer this question.

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