Search code examples
salesforceapex-code

Can you programmatically determine if a user is licensed for a package?


I am using the LMA (License Management Application) and want to know if it is possible to programmaticaly tell if a user has been licensed for my package.

Imagine if I wanted users of the application to see each other's application specific data - at minimum I would need a list of users that are licensed to use the application.

Is this possible? I want to be able to add code to the package that can be used to make decisions based on whether users have been granted a license seat through the LMA's "Manage Licenses" process.

Update: I've discovered that you can tell if the currently logged in user is licensed via the UserInfo.isCurrentUserLicensed(namespace) method - but so far no way to get a list of all licensed users.


Solution

  • UserInfo.isCurrentUserLicensed(namespace) is the only method related to licensing from apex sadly, there is currently no way to get all licensed users of an application programmatically.

    There's an idea for this on the appexchange which it can't hurt to vote for: https://sites.secure.force.com/success/ideaView?id=08730000000bj7xAAA