+ Start a Discussion
jeremyyjeremyy 

Unable to filter on User.UserType

SELECT Id FROM Lead WHERE Owner.UserType = 'PowerPartner'

Result: 

 

INVALID_FIELD: 
SELECT Id FROM Lead WHERE Owner.UserType = 'PowerPartner'
                          ^
ERROR at Row:1:Column:27
No such column 'UserType' on entity 'Name'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
INVALID_FIELD: SELECT Id FROM Lead WHERE Owner.UserType = 'PowerPartner'                          ^ERROR at Row:1:Column:27No such column 'UserType' on entity 'Name'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

 

What's wrong with this query?

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
jeremyyjeremyy

It's because Lead.Owner is polymorphic.

 

http://www.tgerm.com/2010/11/no-such-column-on-entity-error.html