Scenario 6: Get User Details and Device Details
The response from $env.getUserInfo() returns from the User table, which is based on the SFDC User object.
If the permission of a specific field from the SFDC User object prevents access, the code-snippet does not return the corresponding field value.
Response body
Name
Type
Username
string
FirstName
string | null
LastName
string
Country
string | null
Email
string
ProfileId
string
UserType
string | null
LanguageLocalKey
string
LocaleSidKey
string
TimeZoneSidKey
string
Rest of the fields from the User record
For more information, see Salesforce Developers.
Sample code for $env.getUserInfo()
{
"Username": "cs@s.m",
"FirstName": "Snippet",
"LastName": "Code",
"Country": "",
"Email": "eng.fsa.developers@servicemax.com",
"ProfileId": "00e1R000001LAyWQAW",
"UserType": "Standard",
"LanguageLocaleKey": "en_US",
"LocaleSidKey": "en_US",
"TimeZoneSidKey": "America/Los_Angeles",
"UserPreferencesShowMobilePhoneToGuestUsers": "false",
"UserPreferencesShowCityToExternalUsers": "false",
"DefaultCurrencyIsoCode": "USD",
"Street": "",
"UserPreferencesDisableEndorsementEmail": "false",
"UserPreferencesShowPostalCodeToGuestUsers": "false",
"GeocodeAccuracy": "",
"Division": "",
"UserPermissionsSiteforceContributorUser": "false",
"UserPreferencesCacheDiagnostics": "false",

"UserPreferencesDisableLikeEmail": "true",
"UserPreferencesDisMentionsCommentEmail": "false",
"CreatedById": "00536000004ORAKAA4",
"CommunityNickname": "cs",
"UserPreferencesShowWorkPhoneToExternalUsers": "false",
"UserPreferencesShowEmailToGuestUsers": "false",
"UserPreferencesShowTitleToExternalUsers": "true",
"UserPreferencesHideSecondChatterOnboardingSplash": "false",
"UserPreferencesDisableLaterCommentEmail": "false",
"UserPermissionsJigsawProspectingUser": "false",
"UserPermissionsOfflineUser": "false",
"UserRoleId": "00E36000000kwHiEAI",
"UserPreferencesDisableFeedbackEmail": "false",
"UserPreferencesEventRemindersCheckboxDefault": "true",
"UserPreferencesShowCityToGuestUsers": "false",
"UserPreferencesSortFeedByComment": "true",
"MediumBannerPhotoUrl": "/profilephoto/005/E",
"UserPreferencesDisableFollowersEmail": "false",
"UserPreferencesTaskRemindersCheckboxDefault": "true",
"UserPermissionsWorkDotComUserFeature": "false",
"UserPermissionsSFContentUser": "false",
"UserPreferencesShowFaxToGuestUsers": "false",
"Address": "",
"SVMXC__FaceTime_ID__c": "",
"SmallBannerPhotoUrl": "/profilephoto/005/D",
"UserPreferencesJigsawListUser": "false",
"UserPreferencesShowStateToExternalUsers": "false",
"CompanyName": "",
"SVMXC__Select__c": "false",
"UserPermissionsSupportUser": "false",
"UserPreferencesShowCountryToGuestUsers": "false",
"DelegatedApproverId": "",
"CreatedDate": "2020-02-26T22:51:45.000+0000",
"MobilePhone": "",
"UserPreferencesSuppressTaskSFXReminders": "false",
"UserPreferencesActivityRemindersPopup": "true",
"UserPreferencesShowManagerToExternalUsers": "false",
"UserPreferencesHideLightningMigrationModal": "false",
"State": "",
"LastModifiedById": "00536000004ORAKAA4",
"DefaultGroupNotificationFrequency": "D",
"FederationIdentifier": "",
"OfflinePdaTrialExpirationDate": "",
"SenderName": "",
"UserPermissionsSiteforcePublisherUser": "false",
"UserPreferencesDisProfPostCommentEmail": "false",
"StayInTouchNote": "",
"DigestFrequency": "D",
"UserPermissionsInteractionUser": "false",
"MediumPhotoUrl": "https://guohong-dev-ed--c.na82.content.force.com/profilephoto/005/M",
"EmailEncodingKey": "ISO-8859-1",
"UserPreferencesRecordHomeSectionCollapseWTShown": "false",
"UserPreferencesHideCSNDesktopTask": "false",
"UserPermissionsMobileUser": "false",
"UserPreferencesEnableAutoSubForFeeds": "false",
"UserPreferencesFavoritesShowTopFavorites": "false",
"SVMXC__ServiceMax_User__c": "false",
"Department": "",
"AccountId": "",
"UserPreferencesDisableProfilePostEmail": "false",
"SenderEmail": "",
"UserPreferencesGlobalNavBarWTShown": "false",
"UserPreferencesShowEmailToExternalUsers": "false",
"StayInTouchSubject": "",
"EmailPreferencesAutoBccStayInTouch": "false",
"UserPreferencesShowCountryToExternalUsers": "false",
"IsPortalEnabled": "false",
"OfflineTrialExpirationDate": "",
"Name": "Snippet Code",
"IsExtIndicatorVisible": "false",
"UserPreferencesShowStreetAddressToExternalUsers": "false",
"UserPreferencesFavoritesWTShown": "false",
"StayInTouchSignature": "",
"FullPhotoUrl": "https://guohong-dev-ed--c.na82.content.force.com/profilephoto/005/F",
"BadgeText": "",
"Latitude": "",
"LastViewedDate": "",
"UserPreferencesDisableMentionsPostEmail": "false",
"Fax": "",
"City": "",
"ForecastEnabled": "false",
"SVMXC__Is_Super_Dispatcher__c": "false",
"UserPreferencesSuppressEventSFXReminders": "false",
"UserPreferencesShowWorkPhoneToGuestUsers": "false",
"IsActive": "true",
"EmployeeNumber": "",
"EmailPreferencesAutoBcc": "true",
"LastModifiedDate": "2020-02-26T23:29:48.000+0000",
"ManagerId": "",
"AboutMe": "",
"UserPreferencesDisableSharePostEmail": "false",
"UserPreferencesApexPagesDeveloperMode": "false",
"UserPermissionsChatterAnswersUser": "false",
"UserPreferencesHideCSNGetChatterMobileTask": "false",
"UserPreferencesShowManagerToGuestUsers": "false",
"UserPreferencesHideSfxWelcomeMat": "true",
"UserPreferencesPathAssistantCollapsed": "false",
"UserPreferencesCreateLEXAppsWTShown": "false",
"CurrencyIsoCode": "USD",
"UserPreferencesShowTitleToGuestUsers": "false",
"PortalRole": "",
"ReceivesAdminInfoEmails": "false",
"UserPreferencesHasCelebrationBadge": "false",
"UserPreferencesDisableFileShareNotificationsForApi": "false",
"UserPreferencesRecordHomeReservedWTShown": "false",
"UserPreferencesDisableWorkEmail": "false",
"Longitude": "",
"UserPreferencesHideS1BrowserUI": "false",
"UserPreferencesDisCommentAfterLikeEmail": "false",
"UserPreferencesHideBiggerPhotoCallout": "false",
"BannerPhotoUrl": "/profilephoto/005/B",
"UserPreferencesShowFaxToExternalUsers": "false",
"Id": "0051R00000HiCg2QAF",
"UserPreferencesShowStreetAddressToGuestUsers": "false",
"JigsawImportLimitOverride": "300",
"UserPreferencesShowPostalCodeToExternalUsers": "false",
"UserPermissionsKnowledgeUser": "false",
"UserPreferencesShowMobilePhoneToExternalUsers": "false",
"UserPreferencesHideEndUserOnboardingAssistantModal": "false",
"PostalCode": "",
"Phone": "",
"LastReferencedDate": "",
"UserPreferencesDisableBookmarkEmail": "false",
"UserPreferencesLightningExperiencePreferred": "false",
"UserPermissionsMarketingUser": "false",
"ReceivesInfoEmails": "false",
"SVMXC__Dispatch_Console_Settings__c": "",
"Title": "",
"Description__c": "",
"UserPreferencesGlobalNavGridMenuWTShown": "false",
"IsProfilePhotoActive": "false",
"Extension": "",
"LastLoginDate": "2021-09-15T17:25:58.000+0000",
"UserPreferencesPreviewCustomTheme": "false",
"UserPreferencesShowStateToGuestUsers": "false",
"UserPreferencesDisableChangeCommentEmail": "false",
"UserPreferencesDisableMessageEmail": "false",
"UserPermissionsCallCenterAutoLogin": "false",
"ContactId": "",
"UserPreferencesHideChatterOnboardingSplash": "false",
"EmailPreferencesStayInTouchReminder": "true",
"UserPreferencesExcludeMailAppAttachments": "false",
"SystemModstamp": "2021-09-20T16:19:53.000+0000",
"UserPreferencesShowProfilePicToGuestUsers": "false",
"UserPreferencesDisableAllFeedsEmail": "false",
"CallCenterId": "",
"SmallPhotoUrl": "https://guohong-dev-ed--c.na82.content.force.com/profilephoto/005/T",
"UserPreferencesReminderSoundOff": "false",
"Alias": "code",
"OutOfOfficeMessage": "",
"Signature": "",
"Profile": null,
"UserRole": null,
"Account": null,
"CreatedBy": "FSA",
"Manager": null,
"Contact": null,
"LastModifiedBy": "FSA"

},
The getDeviceInfo() provides the information from the device.
Response body
Name
Type
timezone
string
timezoneOffset
number | null
manufacturer
string | null
model
string
osName
string | null
language
string
locale
string
Sample code for $env.getDeviceInfo()
{
"timezone": "America/Los_Angeles",
"timezoneOffset": -420,
"manufacturer": "Apple",
"model": "iPhone 11",
"osName": "iOS",
"language": "es",
"locale": "es-MX"
}
Was this helpful?