function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Arun Reddy 44Arun Reddy 44 

Is there a way to determine the number of feature licenses available / remaining? We are particularly interested in Service Cloud. The UserLicense table doesn't seem to give any information on feature licensess.

Team NubesEliteTeam NubesElite
Hi Arun,
We have a UserLicense object in Salesforce, which stores all the license count information.
Link to documentation: UserLicense object.
Query:
select Id, Name, UsedLicenses, TotalLicenses, Status, MasterLabel, LicenseDefinitionKey from UserLicense
Apex Code:
List<UserLicense> users = [select Id, Name, UsedLicenses, TotalLicenses, Status, MasterLabel, LicenseDefinitionKey from UserLicense];

for(UserLicense ul : users){
System.debug('Name: ' + ul.name);
System.debug('UsedLicenses: ' + ul.UsedLicenses);
System.debug('TotalLicenses: ' + ul.TotalLicenses);
}

Thank You
www.nubeselite.com

Developement | Training | Consulting

Please mark this as solution if your problem resolved.
Khan AnasKhan Anas (Salesforce Developers) 
Hi Arun,

Greetings to you!

You can view the feature licenses your company has purchased to know what you have available to assign to your users.

1. From Setup, enter Company Information in the Quick Find box, then select Company Information.
2. See the Feature Licenses related list.

https://help.salesforce.com/articleView?id=users_understanding_feature_licenses.htm&type=5 (https://help.salesforce.com/articleView?id=users_understanding_feature_licenses.htm&type=5)

Also, please refer to below links:

https://help.salesforce.com/articleView?id=000337021&type=1&mode=1 (https://help.salesforce.com/articleView?id=000337021&type=1&mode=1)

https://www.simplysfdc.com/2014/02/salesforce-how-to-report-service-cloud.html

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Arun Reddy 44Arun Reddy 44
Hi Khan and TeamNubiles,

Thanks for you responses. Sorry I should have been more clear in my question. Khan you answer works great if we want to login to Salesforce and view the licenses manually accross all our instances. However, ideally we were looking for some sort of SOQL query so we could automate pulling this information across instances. Do you happen to know if there is anyway we can automate pulling this information?

Pulling from the UserLicense table doesn't provide any context on feature licenses, so that is not what we are looking for. It will only give you break downs of total licenses / licenses assigned for regular Salesforce licences.

Thanks,
Arun
GiuliaMGiuliaM
The better solution I found is this:
SELECT TotalLicenseCount FROM ActiveFeatureLicenseMetric WHERE FeatureType = 'SupportUser' ORDER BY SystemModstamp DESC LIMIT 1
From my understanding it is updated once a week.
 
Aman Gupta 174Aman Gupta 174
Feature Licenses: A feature licence allows a user to access a feature that is not included in the user licence, such as Marketing or Service Cloud User. A user can be allocated an unlimited number of feature licences.
Find a List of All Used Features License in Org
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


Marketing User
Select count() From User where UserPermissionsMarketingUser=true and isActive=true


Service User
Select count() From User where UserPermissionsSupportUser=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


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


Vote on the answer if it was useful to you.
Naveen KNNaveen KN
we have built automation to send available license information to admins at regular intervals. More details in the blog post 
https://www.codekiat.com/2023/04/how-to-check-available-license-in-salesforce-lightning%20.html
rpr3rpr3
List of the Feature Licenses was very helpful.  I was trying to figure out the one for Flow, and this gave me what I needed.  Thank you, Aman!