Newer Version Available
UserInfo Class
Namespace
UserInfo Methods
The following are methods for UserInfo. All methods are static.
getDefaultCurrency()
Signature
public static String getDefaultCurrency()
Return Value
Type: String
Usage
getFirstName()
Signature
public static String getFirstName()
Return Value
Type: String
getLanguage()
Signature
public static String getLanguage()
Return Value
Type: String
getLastName()
Signature
public static String getLastName()
Return Value
Type: String
getLocale()
Signature
public static String getLocale()
Return Value
Type: String
Example
getName()
Signature
public static String getName()
Return Value
Type: String
Usage
The format is one of the following:
- FirstName LastName
- LastName, FirstName
getOrganizationId()
Signature
public static String getOrganizationId()
Return Value
Type: String
getOrganizationName()
Signature
public static String getOrganizationName()
Return Value
Type: String
getProfileId()
Signature
public static String getProfileId()
Return Value
Type: String
getSessionId()
Signature
public static String getSessionId()
Return Value
Type: String
Usage
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.
getTimeZone()
getUiTheme()
Signature
public static String getUiTheme()
Return Value
Type: String
The preferred theme for the current user.
- Theme1—Obsolete Salesforce theme
- Theme2—Salesforce Classic 2005 user interface theme
- Theme3—Salesforce Classic 2010 user interface theme
- Theme4d—Modern “Lightning Experience” Salesforce theme
- Theme4t—Salesforce1 mobile Salesforce theme
- PortalDefault—Salesforce Customer Portal theme
- Webstore—Salesforce AppExchange theme
getUiThemeDisplayed()
Signature
public static String getUiThemeDisplayed()
Return Value
Type: String
The theme being displayed for the current user
- Theme1—Obsolete Salesforce theme
- Theme2—Salesforce Classic 2005 user interface theme
- Theme3—Salesforce Classic 2010 user interface theme
- Theme4d—Modern “Lightning Experience” Salesforce theme
- Theme4t—Salesforce1 mobile Salesforce theme
- PortalDefault—Salesforce Customer Portal theme
- Webstore—Salesforce AppExchange theme
getUserName()
Signature
public static String getUserName()
Return Value
Type: String
getUserRoleId()
Signature
public static String getUserRoleId()
Return Value
Type: String
getUserType()
Signature
public static String getUserType()
Return Value
Type: String
isCurrentUserLicensed(namespace)
isMultiCurrencyOrganization()
Signature
public static Boolean isMultiCurrencyOrganization()
Return Value
Type: Boolean