I'm wondering if it's possible to create programmatically a Salesforce organization (DEV or Sandbox).
2 Answers
You can create a SandboxInfo to create a new sandbox. I do not think this works directly in Apex, but you should be able to make an API call against your org to initiate a creation or refresh.
-
-
@AzertySF No, there's no API for creating "real" developer orgs. You can create a Scratch Org that's a Developer Edition using SFDX, but they expire in a maximum of 30 days. If you're trying to do some sort of continuous integration, SFDX is how you'd want to do this.– sfdcfoxDec 28, 2018 at 15:18
Yes you can do that, You can use Salesforce SFDX command line client to create Scratch (Developer orgs),
And as its a command line you can program it as per your need.
You can go through the trailhead which will let you know the steps to do it.
https://trailhead.salesforce.com/en/content/learn/trails/sfdx_get_started
If you are in hurry, you can just dig into the developer guide https://resources.docs.salesforce.com/210/latest/en-us/sfdc/pdf/sfdx_dev.pdf
-
-
create a new org via apex is not supported yet, probably in future. :) Dec 24, 2018 at 13:55