+ Start a Discussion

Unable to query Owner.ManagerId field from Lead



My query "Select l.Owner.ManagerId, l.OwnerId, l.Name From Lead l" is not giving me any results. I have tried using eclipse, SForce explorer and even th debugger, but it returns "No such column 'ManagerId' on entity 'Name'." I am able to access all other fields from the User object.


Can someone confirm me if this is a bug or whether this field is not accessible.


Thanking you in anticipation




The Owner field on lead is polymorphic (it can be a user or a group) and as such, the relationship in SOQL is to a subset of fields in the sobject type called Name (as hinted to by the error message), managerId is not one of the fields in the Name subset.


Thanks for the update Simon. So that means we would have to query this field from user additionaly and can nevr be directly fetched.