Check managed app is installed or not

I am integrating Salesforce with ASP.NET application using APEX code. Currently I want to know how can I fetch either the particular managed app is installed in this account or not. As I am not able to find the good documentation on integration with salesforce using apex code, as they have lots of documentation on that. Please share the link of the document integration if anyone knows about it. Thanks in advance.


There are a couple ways you can do this in Apex:

UserInfo.isCurrentUserLicensed(namespace) from the UserInfo class, which will allow you to determine if the package is installed and the current user has a licensed “seat”. Also:

if (Type.forName('ns__KnownObjectInPackage__c') != null) {...} which is agnostic to whether the user has a license or not, but will allow you to determine if the package is installed.

If you want to lean on this logic in an off-platform environment, you could use the Metadata API to retrieve the InstalledPackage elements, or surface a REST/SOAP API in the code you do deploy.

Source : Link , Question Author : Himanshu Jain , Answer Author : Matt and Neil

Leave a Comment