+ Start a Discussion
Meena25Meena25 

Updating opportunity field(lookup to user) to the username who clicks the button

I have a custom button in lightning and whenever user clicks that, whoever clicks should be assigned with his namee. what is the query that i should use in Apex controller
Best Answer chosen by Meena25
Ravi Dutt SharmaRavi Dutt Sharma
User loggedInUser = [SELECT Id FROM User WHERE Id=: UserInfo.getUserId()  LIMIT 1];

This should work for you. Thanks.