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
Scott0987Scott0987 

No such column 'Contact' on entity 'User'

I am trying to get the account and contact based on the portal user and is running the apex code.  I can get the user id using :

 

user uid = [select id from user where id = :UserInfo.getUserId()];

 

but when I add contact to that I get an error " No such column 'Contact' on entity 'User'" even though when I open the user object it has a lookup field called contact.  Any idea how to get the contact and account?

Best Answer chosen by Admin (Salesforce Developers) 
Jerun JoseJerun Jose
Use the following link to get the actual API field names you can use in Apex.
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_user.htm

You will need to use the fields ContactID or Contact.ID and AccountID or Account.ID

All Answers

Jerun JoseJerun Jose
Use the following link to get the actual API field names you can use in Apex.
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_user.htm

You will need to use the fields ContactID or Contact.ID and AccountID or Account.ID
This was selected as the best answer
Scott0987Scott0987

Thank you for your help.