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.
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
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
SELECT MasterLabel, ExpirationDate,TotalLicenses, UsedLicenses FROM PermissionSetLicense
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
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
I have faced lot of issue while searching this using code. Thank you for sharing here.
How to get the total count assigned to my org of featured licences
You can add all features count to get it. Check https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_user.htmhttps://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_user.htm for all features.
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.
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.
Please let me know about UserPermissionsAvantgoUser and UserPermissionsCallCenterAutoLogin
What do you want to know about UserPermissionsAvantgoUser and UserPermissionsCallCenterAutoLogin? Please specify your question.
How can we get the User License expiration Date? Any help is appreciated.
You can refer this post