Get current user information in apex
We can get current logged in user full information from predefined methods in apex. *** // get current user id String loggedUserId = UserInfo.getUserId(); // get current user name String loggedUserName = UserInfo.getName(); // get current user username String loggedUserUserName = UserInfo.getUserName(); // get current user email String loggedUserEmail = UserInfo.getUserEmail(); // get current user language String loggedUserLanguage = UserInfo.getLanguage(); // get current user profile id String loggedUserProfileId = UserInfo.getProfileId(); // get current user role id String loggedUserRoleId = UserInfo.getUserRoleId(); ...