You need to sign in to do that
Don't have an account?

How to get the current User ID in a Apex class
How can I get the current Salesforce User ID in an Apex class?
Any help is appreciated!
Chris
Any help is appreciated!
Chris
You need to sign in to do that
Don't have an account?
UserInfo.getUserId() which returns the user id of the current user.
All Answers
UserInfo.getUserId() which returns the user id of the current user.
c.Description = 'New Contact is created by'+''+userInfo.getUserId(); // Get the Id of the current user
}
Please check this below link for reference.
https://sfdctechsolutions.blogspot.com/2021/07/get-current-user-information-in-apex.html