How to get the name of the sandbox in apex? I know how to determine if the environment is sandbox or production. Is there any metadata available in salesforce to find out the name of the sandbox that is being used (through apex)? If possible through SOQL as well?