5

I am testing my app: at this moment I check does it properly count licenses.

Everything was fine until I started checking Community licenses. I have created a user with a Customer Community Login license. By the Company Information > User Licenses I can see that Customer Community Login license was used. But by requesting /services/data/v54.0/query/?q=SELECT+LicenseDefinitionKey,Name,TotalLicenses,UsedLicenses,Status+FROM+UserLicense I get that UsedLicenses field is equal to 0.

Is there any reason in this behavior? And is there any way to gain access to the same data as in Company Information > User Licenses table on Salesforce?

1 Answer 1

5

Customer Community Login license is a volume-based license:

Each community license can be either a member-based license or a login-based license. To use a login-based license, you first purchase a specific number of logins to be used every month. External users associated with that license consume one login each time they log into a site. However, logging in multiple times during the same day still only consumes one login and, once logged in, switching between sites doesn’t consume extra logins. This type of login is referred to as a daily unique login.

....therefore it's measured and reported on a monthly basis. UserLicense should track this kind of usage via MonthlyLoginsUsed field:

The number of successful logins for all users associated with a customer or partner portal user license. This field has a non-null value if MonthlyLoginsEntitlement has a non-null value.

Unfortunately the MonthlyLoginsUsed and MonthlyLoginsEntitlement fields are not visible to a customer tenant/org, we checked all the way to API v21. Translation: this is a documentation bug.

At some point TenantUsageEntitlement object was introduced, it is thinly documented. In official SF docs this object shows up as late as v52...and disappears after that. That is, as of this writing v53-... API docs don't show this object yet the object does exist and can be queried. The object has a number of fields, here are the relevant ones:

MasterLabel - human-readable description of entitlement
Setting - entitlement key
AmountUsed
CurrentAmountAllowed
Frequency - entitlement term frequency (Monthly, Daily, ...)

Value of Setting is a String key that represents a particular entitlement. For Customer Community Login license, the value of this key is setting/force.com/orgValue.MaxCustComUniqueLogins. Doing a query on TenantUsageEntitlement in API v54 with this setting does retrieve the entitlement (CurrentAmountAllowed) but not actual usage (AmountUsed is blank) :(

Leaving this incomplete answer up for future updates.

3
  • Should I have any kind of permissions to retrieve value of this field? I have tried to do this, but as a result I got "No such column 'MonthlyLoginsUsed' on entity 'UserLicense'" error in Workbench. Jun 14, 2022 at 15:19
  • @YuriiSaiapin It gets better - doc says the usage fields are present in UserLicense but the API shows no such fields, we checked all the way to v21. That is, the doc doesn't reflect reality and our answer is wrong. The correct answer appears to be TenantUsageEntitlement object...but checking one of our Production orgs with the login-based Community license, the usage is not logged in this object. This object has the usage data and limits for just about everything else, incl. the limit for community logins. Congrats, you just unearthed two SF bugs in one question.
    – identigral
    Jun 14, 2022 at 16:20
  • @Swetha Is there a KI for TenantUsageEntitlement not showing usage for community login license
    – identigral
    Jun 14, 2022 at 16:50

You must log in to answer this question.

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