5

Is there any way to programmatically get a list of sandboxes linked to a production org?

I'd also like to do the reverse: get the ID of the production org corresponding to a sandbox -- but from the answers to "Can the production org id corresponding to a sandbox org id be found via Apex?" it appears that is impossible.

2

I don't think there is any official method for it. If no one else here tells us better, the only way I can think of to get the information is to use the PageRef.getContent() method on the setup url for the sandboxes and parse the HTML.

  • Specifically, the SObject "Sandbox" isn't enabled for access through the API/Apex Code. I tried... Organization[] o = [select id... from organization] (okay!), Sandbox[] s = [Select id... from sandbox] (error: No access to entity: Sandbox). – sfdcfox Oct 29 '14 at 21:00
  • As an unfortunate there are a lot of points in the setup, which I found only extractable via getContent(). I don't like the approach, because it's possibly unstable in the future and for sure very ugly - but as a last resort better than nothing. – Uwe Heim Oct 29 '14 at 21:03

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.