I am running the following query in salesforce to get the country

SELECt name, owner.country from lead

This gives the following error:

No such column 'country' 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.

However this works just fine if I do

SELECt name, owner.id from lead
SELECt name, owner.username from lead
SELECt name, owner.name from lead

It gives the data

1 Answer 1


This is a result of the OwnerId field on Lead being a 'Polymorphic' relationship field i.e. it relates to more than one object (User or Group).

This field actually looks up to a 'Name' object. You can use the Force.com IDE schema browser to see what fields are available on this object:

schema browser

As you can see, there is no 'Country' field hence the error you're getting.

There's a great article on the subject here

backed up by SFDC documentation here

and here


You must log in to answer this question.

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