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
daofu hudaofu hu 

Didn't understand relationship 'Account' in field path when quering User object

I have a customized Search page in my developer Edition.
And I used pagination feature to display search results.

After clicking the tab of the Search page, Search page displayed correctly
with executing correctly an Apex code to get User information with SOQL below when displaying the Search page.

Select    ...
from    User
Where 
    Account.Id = :accId

But when I click next page link of pagination feature, it runs error said below.
>>Didn't understand relationship 'Account' in the field path.

If I changed Account. Id to AccountId it runs correctly.
This error only happened by community user. This error didn't happen by internal manager user.

thanks for any hint.
daofu hudaofu hu
The complete message is below.
Didn't understand relationship 'Account' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
Rounak SharmaRounak Sharma

hello daofu,

Can you please provide the complete code or the exact query what you are trying as I think Account.Id will not be recognised 

Rounak SharmaRounak Sharma

when ever we do a relationship query we need to check the chilld object name in that. If you see AccountId is the api name and there is nothing like Account.id. in the below screen shots you can see that one behaves as object and other as ID. that's why you are getting error while doing.

User-added imageUser-added image
Please mark it as as best answer if it helped you in any way.

thanks