I have a managed package that can be installed in multiple organization types. Attempting to use the following query causes install failure when used in my postinstall script.

[SELECT OrganizationType from Organization LIMIT 1]

Is it possible to get the organization type in a postinstall script so that I can enable/disable necessary features?

Update: What I really need to know is if my package has been installed in a Professional edition org. I can do without actually knowing the type.

  • Do you have any API restrictions on your managed package?
    – Phil B
    Mar 26, 2014 at 15:41
  • None that are set on the package. However, I need to be able to install into a Professional edition org in addition to Enterprise/Performance/Nonprofit.
    – cseaton
    Mar 26, 2014 at 17:18
  • What error message are you getting in the install failure? Mar 26, 2014 at 18:16
  • Attempting to install into a professional edition org results in the following error. "Your requested install failed. Please try this again."
    – cseaton
    Mar 26, 2014 at 19:31

2 Answers 2


[SELECT OrganizationType from Organization LIMIT 1] does work in a professional edition org.

It turns out that there was reference to a field in my code that isn't supported in a Professional Edition org. That's why I was getting an error when attempting to install in a Professional Edition org.


Don't forget that the postinstall script runs as a user with some pretty funky permissions, so test carefully (meaning do installations of a beta package) because standard unit testing won't reveal installation errors.

Also, Organization is only accessible to users with View All Data permission (or Modify All Data), so you may need to work around that or ensure that only System Administrators install your package.

Having said that, Organization is available to the postInstall user in all orgs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.