You need to sign in to do that
Don't have an account?

Save error: Invalid field AccountId for SObject User
for (User u : Trigger.new) {
AccountShare share = new AccountShare();
share.AccountId = u.AccountId;
}
Why is the IDE telling me that User doesn't have an AccountId field?
I actually have another sandbox that has the customer portal enabled and I do not see it in that schema in the force.com IDE either. Are you seeing it as an available field?
Do you need to go through contact id? Since a customer portal user comes from a contact which is linked to an account.
Sorry I cannot be of any help just thought you could check your schema to see if it is indeed an available field that is related to the object you are trying to make use of. But the way i look at it is if you look at your customer portal user record and there is an account lookup field there then that field would be usable for the User object but if there is not then it probably isnt.
Both the force.com IDE and SoqlXplorer can query it, which means it's available through the WS API. Also, this link to the documentation User object shows that AccountId is a field on the User object.
It may be an Apex bug. In any case, I just worked around it.
Hi jeremy, i am facing the same issue. Whats the workaround?
Thanks
Sid
I don't recall. I probably grabbed User.ContactId and queried for the Contact's AccounId field.