Skip to content

Instantly share code, notes, and snippets.

@Nahumancer
Last active February 9, 2020 16:57
Show Gist options
  • Save Nahumancer/e0b40b4fa24e65f6714edd31132a9198 to your computer and use it in GitHub Desktop.
Save Nahumancer/e0b40b4fa24e65f6714edd31132a9198 to your computer and use it in GitHub Desktop.
Salesforce Apex: Check if the current ORG is a Sandbox. / Required: Summer '14 (version 31.0)
// To be used like:
// if (OrgUtilities.runningInASandbox()) { etc.. }
public class OrgUtilities {
public static Boolean runningInASandbox {
get {
if (runningInASandbox == null) {
runningInASandbox = [SELECT IsSandbox FROM Organization LIMIT 1].IsSandbox;
}
return runningInASandbox;
}
set;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment