I am building my very first desktop application using c# and visual studio! It currently logs into an org through the Partner WSDL / SOAP API.

But I have no idea how to license it! Ideally, I would like to query the production organization id for comparison to some sort of licence-checking server.

However, I have no idea how to find it if the application is logged into a sandbox instead of production!

Any tips?

1 Answer 1


If your create a managed package, you can have them install it in their org. Installed packages are also copied when sandboxes are created and refreshed. As such, you could then query the PackageLicense object to make sure it is installed and not expired. This would work for production and sandbox orgs.

Keep in mind, however, that sandboxes are always licensed to managed packages. If that's a concern, you might make sandbox performance limited compared to production orgs. This is generally not a problem, though, since sandboxes are only for development and testing.

  • That is not really a problem. I already can tell if it is a sandbox, versus if it is production. The problem is, let's say a company buys the program. How do I make sure that it works for their production org, AND their sandboxes?
    – FNG
    Dec 24, 2017 at 22:56
  • @FNG I edited in a different answer that based on your comment. Does this help you?
    – sfdcfox
    Dec 24, 2017 at 23:22
  • Negative... this is not an AppExchange program, it is a desktop application for Microsoft Windows. Good old .exe and .dll files, logging into Salesforce through the Partner API.
    – FNG
    Dec 26, 2017 at 1:25
  • @FNG Doesn't matter. Managed packages can be used without an AppExchange listing. I would recommend this approach because there's no API to query a list of sandboxes that I'm aware of.
    – sfdcfox
    Dec 26, 2017 at 1:30

You must log in to answer this question.

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