+ Start a Discussion
Chamil MadusankaChamil Madusanka 

Current user Id in apex class

Hi,

 

How can I get current user Id in apex code? I tried {!$User.Id}. But it didn't work. How to resolve it?

 

Thanks in Advance

Best Answer chosen by Admin (Salesforce Developers) 
nbknbk

Hello,

Can you try this

UserInfo.getUserId()