I'm wondering how to implement user restrictions to an SFDC AppExchange App based on Licenses with the LMA. The idea is that only users within a customer's org who have been assigned a license have access to the app.

Our app is already developed, but currently, everyone in the installed org has access to it and can use it. Its mainly visualforce pages and controllers. In order to publish the app as a paid app with the LMA, will extra development need to be done to handle restricting access to the app based on who has licenses?

Is there documentation on this?

1 Answer 1


Generally speaking, there's nothing "special" you need to do (in most cases). Once you switch to a per-license model, salesforce will automatically restrict access to all components in your package unless the logged in user has a license assigned, even if they have permission at the profile/permission set level. From their perspective, they won't even know the package is installed short of looking at Setup > Installed Packages.

The only exception you need to make is if you have triggers or other logic that they would have access to indirectly that should only function for licensed users. In that case, you can use UserInfo.isCurrentUserLicensed(namespace) to determine if the user has a license assigned to that package. I haven't worked on a lot of packages, but I've yet to actually need this feature.

  • 1
    How does a developer switch an app to a per-license model?
    – Tyler Zika
    Commented Nov 8, 2016 at 18:13
  • 1
    @TylerZika You don't set it in the app, you specify it by License record. See the LMA documentation. Basically, there's a checkbox for Site license, and a number field for the number of licenses to assign. You can edit the License record to directly affect the number of licenses, Site-wide status, trial mode, expiration date, etc.
    – sfdcfox
    Commented Nov 8, 2016 at 18:25

You must log in to answer this question.

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