Is there an API method to return what edition current customer is using?

  • 3
    can you expand on why you want to determine this? typically there are better ways to control things than the edition in use.
    – superfell
    Commented Aug 9, 2012 at 6:02

2 Answers 2


You can query the OrganizationType from the Organization object.

select OrganizationType from Organization

As of API 32 possible values are: ["Team Edition","Professional Edition","Enterprise Edition","Developer Edition","Personal Edition","Unlimited Edition","Contact Manager Edition","Base Edition"]

Where Team Edition is commonly referred to as Group Edition and Base Edition is known as Performance Edition.

These values are derived from:

Schema.DescribeFieldResult dfr = Schema.sObjectType.Organization.fields.OrganizationType; List<String> values = new List<String>(); for(Schema.PicklistEntry ple : dfr.getPicklistValues()){ values.add(ple.getValue()); } system.debug(JSON.serialize(values));

  • 5
    Note that this requires the "View All Data" perm to run, or must be run in apex declared as without sharing! Commented Aug 8, 2012 at 0:58
  • @Daniel, could you add in what the possible options for OrganizationType are?
    – Benj
    Commented Aug 8, 2012 at 11:58
  • I can confirm (from SOQLXplorer) that another is "Developer Edition".
    – metadaddy
    Commented Aug 8, 2012 at 15:57
  • 1
    If you're using databasedotcom gem, then you can do something like this: client.materialize('Organization').first.OrganizationType Commented Aug 8, 2012 at 17:06
  • Note that when in a Group Edition org, the actual returned value is "Team Edition", not "Group Edition". I have edited the post to reflect this. The API docs for the Organization object do not list out all possible values, so I'm curious, Daniel, where you got your list of possible values.
    – zachelrath
    Commented Jan 14, 2013 at 15:31

Use below class to determine the instance and edition of salesforce.

public class whereAmI{

// First method will give us the edition as a string 

public Static String getEdition(){

    // Organization object FTW!
    Organization[] org = new Organization[]{};
    org = [select Id, OrganizationType from Organization limit 1];

    // Check to make sure we have a result
        return org[0].OrganizationType;
        return '[still lost...]';

// Next method tells us if we're in a sandbox

public Static Boolean isSandbox(){

    String host = URL.getSalesforceBaseUrl().getHost();
    String server = host.substring(0,host.indexOf('.'));

    // It's easiest to check for 'my domain' sandboxes first 
    // even though that will be rare
        return true;

    // tapp0 is a unique "non-cs" server so we check it now
    if(server == 'tapp0')
        return true;

    // If server is 'cs' followed by a number it's a sandbox
            catch(exception e){
                //started with cs, but not followed by a number
                return false;

            //cs followed by a number, that's a hit
            return true;

    // If we made it here it's a production box
    return false;

Courtesy : http://www.michaelforce.org/recipeView?id=a0Ga000000Ekp65EAB

  • so not all sandboxes start with cs?
    – Phil B
    Commented Oct 30, 2013 at 20:46

You must log in to answer this question.

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