2

I would like to be able to query the Sandbox configuration data. For example, if you go to the "Sandboxes" link in the setup of your production org, I want to be able to query that info (Name, Type, Location, Current Org Id, etc) via soql or via an API call.

Does anyone know if there's a way this can be done? Tooling API, metadata API, native soql, etc?

  • 1
    I haven't looked at it in depth yet, but there are new sandbox management enhancements coming in Winter '16. See Sandbox Enhancements. There is also the SandboxInfo object in the v35.0 Tooling API. Again, I don't have a production org on Winter 16 to test it with yet. – Daniel Ballinger Oct 5 '15 at 21:54
  • Ah that looks promising. I will take a look once I have a Winter 16 org to play with. Thanks – fehays Oct 5 '15 at 22:44
  • 1
    As lame as it sounds, I created a web scraper in Kimono that grabs all the data from that page. Then I just all that api to get that data, and personally load it into a custom object that I can then query from wherever I need to. It works, but doesn't use any Salesforce API's to get it. – cricketlang Oct 6 '15 at 20:23
1

Maybe not directly what you are looking for, but I stumbled across the Sandbox EventLogFile.

Description from the docs:

Sandbox events contain details about sandbox copies.

Of particular interest were some of the fields that it captures:

  • CURRENT_SANDBOX_ORG_ID - The 15-character ID of the current sandbox organization.
  • PENDING_SANDBOX_ORG_ID - The 15-character ID of the target sandbox org.
  • SANDBOX_ID - The 15-character ID of the sandbox organization.
  • STATUS - The status of the sandbox copy.

The catch here is that Event Logs are a paid feature. Still, it may be useful if you can get it. When available, you can access it with both the REST and SOAP apis.

| improve this answer | |
0

We can query using Tooling API on SandboxInfo.

SELECT Id, LicenseType , SandboxName FROM SandboxInfo

But you can run this query in Production org only.

If you are in current sandbox and want some detail then make a SOQL on organization:

SELECT createddate, IsSandbox, InstanceName, OrganizationType FROM Organization
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.