function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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.