function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MJ Kahn / OpFocusMJ Kahn / OpFocus 

Use Apex to tell what Salesforce Edition you're in

I'm developing a managed package that needs to behave differently depending on whether its installed in a Trial Edition org, a Developer Edition org, a Sandbox org, or a Production org. Is there any way that Apex can determine what type of Salesforce Edition or org it's running in?

 

(I know how to tell if it's a sandbox -- it's the other editions / org types that I need help with.)

 

Thanks!

sfdcfoxsfdcfox

You can query Organization for the OrganizationType field and the TrialExpirationDate to see if it's a trial. That's the only way I know of to get this level of detail.