User u = [SELECT Id,ContactId,Contact.AccountId FROM User WHERE Id = :UserInfo.getUserId()];

id conid=uContactId;
id acid=u.Contact.AccountId;

this are possible or not, please anybody help me

closed as unclear what you're asking by David Reed, Himanshu, Oleksandr Berehovskyi, Raul, battery.cord Feb 28 '18 at 14:12

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


Accountid and contactid are populated if you run this as a community user /portal users .For admin Users those value are null

Not the answer you're looking for? Browse other questions tagged or ask your own question.