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

Package license assignment using apex



After installing a managed package from AppExchange, we can assign the package licenses using manage licenses link. Is there any way either using APEX or any API (enterprise/partner/metadata) to retrieve the information about managed package license assignment for an org.




Best Regards,

Lakhan Prajapati

Anup JadhavAnup Jadhav

I don't believe you can access the installed appexchange package licence via API or Apex.


- Anup

Heather ThompsonHeather Thompson
PackageLicense pl = [SELECT Id FROM PackageLicense WHERE NamespacePrefix = 'Test'];
User u = [select id from user where firstname = 'Test'];
insert new UserPackageLicense(UserId =, PackageLicenseId =;
devil lyndadevil lynda
Hello Friends
I am Lary Lynda (
I need apex licence code anyone Can give me??
Thanks Heather,Your piece of code worked