+ Start a Discussion
.Net Api.Net Api 

Capturing Username of Sales force

I want Capture the username of sales force


please guide me




Praveen Gaddam


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




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


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


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.


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.