I created a custom button in Account. When user clicks on this custom button and it will access to a VF page. In the VF page, I would like to display and capture who clicks the custom button. So my initial approach is to create a custom lookup field that lookup to User object. But I'm having problem of how to find out who clicks the custom button and capture it into this lookup field then populate it in the VF page.
1 Answer
Use UserInfo Class
, it will help you get any information you need.
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_userinfo.htm
-
I got it working by using UserInfo.getUserId() method to assign it to the lookup field.– R.SparkCommented Jun 9, 2014 at 22:08