The following are methods for UserInfo. All methods are static.
public static String getDefaultCurrency()
Type: String
For Apex saved using Salesforce API version 22.0 or earlier, getDefaultCurrency returns null for single currency organizations.
public static String getFirstName()
Type: String
public static String getLanguage()
Type: String
public static String getLastName()
Type: String
public static String getLocale()
Type: String
String result = UserInfo.getLocale(); System.assertEquals('en_US', result);
public static String getName()
Type: String
The format is one of the following:
public static String getOrganizationId()
Type: String
public static String getOrganizationName()
Type: String
public static String getProfileId()
Type: String
public static String getSessionId()
Type: String
For Apex code that is executed asynchronously, such as @future methods, Batch Apex jobs, or scheduled Apex jobs, getSessionId returns null.
As a best practice, ensure that your code handles both cases – when a session ID is or is not available.
public static System.TimeZone getTimeZone()
Type: System.TimeZone
TimeZone tz = UserInfo.getTimeZone(); System.debug( 'Display name: ' + tz.getDisplayName()); System.debug( 'ID: ' + tz.getID());
public static String getUiTheme()
Type: String
The preferred theme for the current user.
public static String getUiThemeDisplayed()
Type: String
The theme being displayed for the current user
public static String getUserEmail()
Type: String
String emailAddress = UserInfo.getUserEmail(); System.debug( 'Email address: ' + emailAddress);
public static String getUserName()
Type: String
public static String getUserRoleId()
Type: String
public static String getUserType()
Type: String
public static Boolean isMultiCurrencyOrganization()
Type: Boolean