Search code examples
salesforceapex-codevisualforce

How can we get the installed package information within apex controller in salesforce?


We have an apex controller in our package and want to know the "number of days" left before the trial period of our package expires for the logged in user.

We would need to access the installed package information for this purpose.

Is there a way to get this information through callouts to LMO (License Management Org)? Or is there any object or DescribeResult methods to obtain this information?


Solution

  • There is a very similar question on the Salesforce StackExchange site - Installed Package information, specifically Status.

    Within the subscriber Org with Apex there isn't any licensing information beyond UserInfo.isCurrentUserLicensed().

    You should be able to create an Apex WebService Method in the LMO to return the trial expiry date. Unfortunately, once the managed package has expired you won't be able to use it to make the callout.

    There are details on the required entities in the License Management App 2.1 Administration and User Guide (pdf)

    License Entity Relationship Diagram