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
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