AdminHow to Guides

How to Identify If Your Salesforce Org Is a Sandbox or Production?

How to Identify If Your Salesforce Org Is a Sandbox or Production

When working with Salesforce, identifying whether your organization is a sandbox or a production environment prevents errors and ensures that your actions affect the correct data set.

Why It’s Important to Know Your Org Type?

There are many situations where you need to know whether your Salesforce org is a Sandbox or a Production environment.

For instance, I recently worked on an integration where the API required the type of org to be passed in the request body. The API handled real-time data updates, so sending data from a sandbox could unintentionally affect live records in the connected system. That’s why passing the correct org type is important—so you know exactly how the data will be processed.

The Simple Way to Check: Use the Organization Object

Salesforce has an object called Organization that holds proper metadata about your org. With just one SOQL query, you can quickly determine the sandbox or production environment type.

				
					SELECT Id, Name, OrganizationType, IsSandbox FROM Organization
				
			

What Each Field Tells You:

  • Id: The unique ID of your org.
  • Name: The name of your Salesforce organization.
  • OrganizationType: Tells you the edition you’re using (e.g., Developer Edition, Enterprise).
  • IsSandbox:  returns true if the org is a sandbox and false if it’s production.
  • InstanceName: The server instance your org is running on.

Just by checking the value of IsSandbox, you can clearly tell the environment type.

How to Identify If Your Salesforce Org Is a Sandbox or Production?

Summary

To find out whether your Salesforce org is a sandbox or production, you only need a simple query on the Organization object. Look for the IsSandbox field—if it’s true, you’re in a sandbox. If it’s false, you’re working in a live production environment.

Shares:

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *