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
MoemontyMoemonty 

Customer Portal - Exposing information for the current user.

Hello all,

 

I'm trying to create a controller that will expose information for only the current user of the customer portal.

 

My SOQL looks like this.

 

 StuInfo = [select FirstName, LastName, Contact_Status__c,

id from Contact WHERE id =:usrId]; 

 

I'm looking to place the id of the User that is currently logged into the Customer portal, so that customer only has access to their own records.

 

How do I go about doing this, with the Site method 'createPortalUser'?

 

 

Thanks in advance,

 

Moises Montenegro 

 

 

imuinoimuino

If i understand right what you want is to get the current user Id's?

Just use User.Id on your controller

Pradeep_NavatarPradeep_Navatar

You can get the current user if by the function "UserInfo.getUserId()" with this help you can fetch information from the user object.


If the org has customer portal enabled only then there will be the lookup of contact in the user object from where you can get the id or any information about the contact object as you desire.


Please do use the following in the where clause:-


"where id=Userinfo.getUserid()"