salesforce how to check sandbox type code example
Example 1: how to find sandbox name in salesforce types
SELECT Id, InstanceName, IsSandbox, Name, OrganizationType FROM Organization
Example 2: how to find sandbox name in salesforce types
private static Boolean runningInASandbox() {
return [SELECT Id, IsSandbox FROM Organization LIMIT 1].IsSandbox;
}