35

The Salesforce docs describe the UserInfo.getUserType() call, which returns the same options as user.UserType. But I can't figure out where to find a list of the possible return values. Please provide a complete list, including what each value means.

0

6 Answers 6

37

Your best bet is to refer to the Salesforce api docs. They do a good job of explaining the fields and their possible values. The link to the doc in question is: https://developer.salesforce.com/docs/atlas.en-us.212.0.api.meta/api/sforce_api_objects_user.htm

I've included the snippet from the UserType field below.

Description The category of user license. Each UserType is associated with one or more UserLicense records. Each UserLicense is associated with one or more profiles. In API version 10.0 and later, valid values include:

  • Standard: user license. This user type also includes Salesforce Platform and Salesforce Platform One user licenses. Label is Standard.
  • PowerPartner: PRM user whose access is limited because he or she is a partner and typically accesses the application through a partner portal. Label is Partner.
  • CSPLitePortal: user whose access is limited because he or she is an organization's customer and accesses the application through aCustomer Portal. Label is High Volume Portal.
  • CustomerSuccess: user whose access is limited because he or she is an organization's customer and accesses the application through a Customer Portal. Label is Customer Portal User.
  • PowerCustomerSuccess: user whose access is limited because he or she is an organization's customer and accesses the application through a Customer Portal. Label is Customer Portal Manager. Users with this license type can view and edit data they directly own or data owned by or shared with users below them in the Customer Portal role hierarchy.
  • CsnOnly: user whose access to the application is limited to Chatter. This user type includes Chatter Free and Chatter moderator users. Label is Chatter Free.
3
  • 8
    There are some undocumented usertypes, such as Guest, which is used for force.com and site.com sites users.
    – Ryan Guest
    Nov 7, 2012 at 5:47
  • 3
    Here's a bit more info about UserType guest. Ryan is correct in that they appear in a EE/UE SF orgs' Force.com site.
    – Scott
    Feb 7, 2014 at 0:21
  • 1
    Additionally, if the Automated Process user is running (most commonly seen as the user creating DuplicateRecordSet and DuplicateRecordItem objects as part of Salesforce Duplicate Management), the UserType returned by this "ghost" user is "AutomatedProcess". Similarly, the License Management App "ghost" user has a UserType of "LicenseManager". I call these "ghost" users because they don't exist as User records and are not returned in SOQL queries. Oct 31, 2017 at 6:07
7

Tim Smith's excellent answer already covers the User Types that are currently documented by Salesforce, so I'll focus on the "undocumented" ones.

This screenshot was taken from a picklist lookup, triggered from the List View customization screen for the User object. It should be a complete list of all User Types as of Spring ’14.

enter image description here

Comparing this list to the one that Tim found with the UserType field on the User Object API Documentation page, it would appear that there are two "undocumented" User Types.

  • Guest
  • Self Service

As Ryan Guest pointed out, the "Guest" User Type is used exclusively for unauthenticated Force.com and Site.com sites users. This link, provided by Scott, has more information about how this license type is used: Force.com Sites Guest User Licenses.

That leaves the "Self Service" user type.

The "Self Service" User Type appears to have been deprecated, along with the Self-Service Portal, when Spring ’12 was released. Only orgs that existed prior to Spring ’12 continue to have access to the Self-Service Portal. More information about the Self Service Portal can be found in the Self-Service Portal Implementation Guide.

3

Adding one more...

If the running user is the Salesforce to Salesforce (S2S) Connection User, then (as of V32)

UserInfo.getUserType = 'PartnerNetwork'
UserInfo.getFirstName = 'Connection'
UserInfo.getLastName = 'User'
UserInfo.getName() = 'Connection User'
UserInfo.getUserRoleId() = null
UserInfo.getProfileId() = some profileId that can't be inspected (insufficent privileges)
UserInfo.getUserId() = some userId that can't be inspected (insufficient privileges)

The S2S Connection User can not be queried for in SObject User

2

It is worth to add that the method returns also:

  • AutomatedProcess: for Automated Process user only
0

Here's what I've figured out so far:

  • Standard: Indicates a full, normal Salesforce.com license
  • PowerCustomerSuccess: Customer Portal - Enterprise Admin (Customer Portal Manager Custom)

If you know others, comment and I'll add them in.

0

One more value I have encountered on top of the values documented on https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_user.htm

  • SfdcAdmin

    UserInfo.getUserType() == 'SfdcAdmin'


In my use case CampaignInfluence records created by standard Salesforce campaign influence model are created in the context of system user with this usertype. I have a flow after insert on CampaignInfluence which makes update on Opportunity under certain conditions. Opportunity has a custom trigger uses fflib which throws exception System.NoAccessException during operations in the custom logic when being executed in this user context. I use this check (UserInfo.getUserType() == 'SfdcAdmin') to bypass the whole Opportunity trigger as workaround until I identify a more reliable solution.

Interestingly enough when I use SOQL to query User for the CreatedById of CampaignInfluence records I receive zero records. LastModifiedBy on Opportunity as a result shows either empty value (only timestamp is displayed) for some users and 'salesforce.com, inc.' for other users. Field history shows that the change was executed by 'Salesforce Administrator'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .