+ Start a Discussion
.Net Api.Net Api 

Capturing Username of Sales force

I want Capture the username of sales force

 

please guide me

 

Regards

 

Praveen Gaddam

kiranmutturukiranmutturu

in apex you can use like this to get the logged in user name..

 

userinfo.getName

ktshannonktshannon

You will have to capture this in Apex in the class and then reference it in the visualforce page.

aballardaballard

Without apex, you can get the username in your page markup with  {!$User.UserName} 

Pradeep_NavatarPradeep_Navatar

If you want to get username of logged in user then you can use SOQL query :

 

                1. In apex code You can use UserInfo.getUserName().

                2. In Visual force You can Use global Variables {!$User.UserName} , it would give the system admin Username.

 

Hope this helps.

aballardaballard

Are you looking for the user's name, or loginname?  And do you want it in apex code or in a page? 
All these combinationsare possible.