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.

1 Answer 1


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.

  • Thanks for your reply. It is possible for you to tell me how can we retrieve the default lead Source, lead rating and industry. If I am using SOQL query like "select LeadSOurce from Lead" then it is giving me the leads record from the inserted leads only but I want the default entry that leadsource contains. Mar 13, 2014 at 12:55
  • 1
    Ask another question @HimanshuJain. Mar 13, 2014 at 15:57
  • Hi, Is it possible for find the installed packages using PartnerWSDL. Actually I don't have any idea about APEX, if it possible to find it using partnerWSDl then it would be good. Thanks in advance. Jul 9, 2014 at 11:22
  • @HimanshuJain that's a separate question. But a great one! Definitely raise this as a new question :-) Jul 9, 2014 at 14:25
  • 2
    To save the time of people coming here from google, UserInfo.isCurrentUserLicensed has been removed from the API as of version 46 and you need to use isCurrentUserLicensedForPackage now. Sep 3, 2019 at 8:20

You must log in to answer this question.

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