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

UserInfo.getUserId() returns Null for Community User
We have this query now SELECT Id, Contact.AccountId, Contact.Account.Name FROM User WHERE Id = : UserInfo.getUserId()
that it suppose to bring back the id and the account name of the Community User which is the Contact of an account in salesforce. but its returning Null back and the page crashes when I use it
It seems to me that UserInfor.getUserId() is not returning a value and that is why I am getting that error . So i am trying to query the current partner community user ...Force.com and access the parent account, which it will always be the same account
that it suppose to bring back the id and the account name of the Community User which is the Contact of an account in salesforce. but its returning Null back and the page crashes when I use it
You must login to the portal to get the user id from UserInfo.getUserId() . you are loading this page after logging in as Community user?

I am having the exact same issue. Trying to build a component that loads on the homepage for a logged in partner community user. Seems to error on this code >string user_id = UserInfo.getUserId(); < which would seem to be the problem you are experiencing. Any resolution found?

Hi I am facing the same problem too. Someone please help it's urgent!!