Home Salesforce Getting Salesforce Licenses Information

Getting Salesforce Licenses Information

by Dhanik Lal Sahni

Our Salesforce Org has lot of license for different kind of application and features installed in Org. These details can easily be checked using Setup-> Company Information.  In this post , I will list out detail to find licensing information using SOQL.

User License:

This object is used to show features which user can access. User permission is assigned using Profile or Permission Set.

Requirement : Find List of All Used and Remaining User License in Org
Solution:
SELECT MasterLabel,Name,Status,TotalLicenses,UsedLicenses,UsedLicensesLastUpdated FROM UserLicense

Permission Set Licenses:

Permission set license is used to assign permissions to use various tools and functions which are not included in User License. We can use permission set licenses to grant access, but not to deny access.

Requirement : Find List of All Used and Remaining Permission Set License in Org
Solution:
SELECT MasterLabel, ExpirationDate,TotalLicenses, UsedLicenses FROM PermissionSetLicense

Feature Licenses:

A feature license entitles a user to access an additional feature that is not part of user license, such as Marketing or Service Cloud User. Users can be assigned any number of feature licenses.

Requirement : Find List of All Used Features License in Org
Solution:

There is no object which expose these detail. As these features are added to user so, we can use User object to find most of features count.

Available Features Licenses

  • Chatter Answers User
Select count() From User where UserPermissionsChatterAnswersUser=true and isActive=true
  • Flow User
Select count() From User where UserPermissionsInteractionUser=true and isActive=true
  • Knowledge User
Select count() From User where UserPermissionsKnowledgeUser=true and isActive=true
  • Chat User
Select count() From User where UserPermissionsLiveAgentUser=true and isActive=true
  • Marketing User
Select count() From User where UserPermissionsMarketingUser=true and isActive=true
  • Offline User
Select count() From User where UserPermissionsOfflineUser=true and isActive=true
  • Salesforce CRM Content User
Select count() From User where UserPermissionsSFContentUser=true and isActive=true
  • Service User
Select count() From User where UserPermissionsSupportUser=true and isActive=true

You may also like

9 comments

Rahul Gupta August 26, 2019 - 7:46 pm

I have faced lot of issue while searching this using code. Thank you for sharing here.

Reply
Karish May 27, 2020 - 3:47 pm

How to get the total count assigned to my org of featured licences

Reply
NISHIT KEDIA July 21, 2020 - 8:58 pm

Thanks for sharing this article. This really helps.

However, I need the total count of each feature licence available in the org or alternatively no. of feature licences remaining.

Thanks,
Nishit

Reply
Dhanik Lal Sahni August 1, 2020 - 9:36 pm

Hello Nishit,
PermissionSetLicense and UserLicense objects have this information. No of remaining features license can be retrieved through user object as these are added to user object.

Thank You,
Dhanik

Reply
SFDC Leaner December 3, 2020 - 4:04 pm

Please let me know about UserPermissionsAvantgoUser and UserPermissionsCallCenterAutoLogin

Reply
Dhanik Lal Sahni February 14, 2021 - 9:45 pm

Hey Siddhartha,

What do you want to know about UserPermissionsAvantgoUser and UserPermissionsCallCenterAutoLogin? Please specify your question.

Thank You,
Dhanik

Reply
Kumar Vivek January 11, 2021 - 4:10 pm

How can we get the User License expiration Date? Any help is appreciated.

Reply
Dhanik Lal Sahni February 14, 2021 - 9:44 pm

Hey Vivek,

You can refer this post

Thank You,
Dhanik

Reply

Leave a Comment