10

I need to distinguish different Org type as follows

  • Production Org
  • Sandbox Org
  • Developer Org
  • Demo Org (created by Salesforce, sometimes called SDO - or created by partners, sometimes called PDO)
  • Trial Org (customer org which will expire)

To distinct Sandboxes I found this Can we determine if the Salesforce instance is production org or a Sandbox org?

select Id, IsSandbox from Organization limit 1

Is there something comparable to distinct the rest?

In addition: is there a way to distinct the different sandbox-types:

  • developer
  • developer pro
  • partial copy
  • full copy

I'm open to solutions via APEX or JavaScript. The less hackish, the better.

1 Answer 1

18

You can use the OrganizationType field on Organization to distinguish between orgs:

system.debug([SELECT OrganizationType FROM Organization]);

This field has following picklist values:

  • Team Edition
  • Professional Edition
  • Enterprise Edition
  • Developer Edition
  • Personal Edition
  • Unlimited Edition
  • Contact Manager Edition
  • Base Edition

This should easily help in distinguishing between Developer and Production. Using the IsSandbox can help in identifying Sandbox vs Production. Further, there is a TrialExpirationDate field on Organization. If it has values, it is an Trial Org.

Using these techniques, you can distinguish between Production, Sandbox, Developer Org, Trial Org (and possibly Demo Org as well).

Also, in Apex, I couldn't find any field to get the type of Sandboxes.

2
  • 1
    Much nicer than page scraping! +1
    – Adrian Larson
    Commented Jul 27, 2015 at 14:42
  • Very good! That's exactly what I was looking for!
    – Uwe Heim
    Commented Jul 27, 2015 at 15:59

You must log in to answer this question.

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