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

Customer Portal and user info class methods
Hi Friends,
My requirement is to display visual force tab in the customer portal.I have to make this tab visible only when customer has logged into the portal and then this tab becomes visible.
When the customer logs in .I need to fetch his username ,firstanem,lastname ,email.How do I fetch this information.
I know that before user is created we have to create contact for the user .
So here is what I have .
contact c;
user u;
c=[Select contactid from user where id=:userinfo.getUserid()];
u=[select username,firstname ,lastname from contact where id=c.userid];
My concern is ,username is not a field in the contact object.How do I retrieve this username and contact id and then use both contact id and username in the where clause of the line written above in red.
Thanks,
Trick
Hi,
username field is available in user object, why you are querying contact object. You can fetch contactId as well as username from single query on User object.
user u=[Select contactid,userName from user where id=:userinfo.getUserid()];