Metadata Coverage
Authorize Your Production Org
Create a Sandbox Definition File
Create, Clone, or Refresh a Sandbox
Limitations for Salesforce DX
Previous PDF Versions
Before you can create a sandbox using Salesforce CLI, define the configuration for it in a sandbox definition file. The sandbox definition file is a blueprint for the sandbox. You can create different definition files for each sandbox type that you use in the development process.
| Option | Required? | Description |
|---|---|---|
| activationUserGroupId | No | A reference to the ID of a public group of Salesforce users who can access the sandbox. The user who created the sandbox is added to the group by default. You can specify either activationUserGroupId or activationUserGroupName but not both. |
| activationUserGroupName | No | The name of the public group of Salesforce users who can access the sandbox. The user who created the sandbox is added to the group by default. You can specify either activationUserGroupId or activationUserGroupName but not both. |
| apexClassId | No | A reference to the ID of an Apex class that runs after each copy of the sandbox. Allows you to perform business logic on the sandbox to prepare it for use. You can specify either apexClassId or apexClassName but not both. |
| apexClassName | No | The name of the Apex class that runs after each copy of the sandbox. Allows you to perform business logic on the sandbox to prepare it for use. You can specify either apexClassId or apexClassName but not both. |
| autoActivate | No | If true, you can activate a sandbox refresh immediately. |
| copyArchivedActivities | No | Full sandboxes only. This field is visible if your organization has purchased an option to copy archived activities for sandbox. To obtain this option, contact Salesforce Customer Support. |
| copyChatter | No | If true, archived Chatter data is copied to the sandbox. |
| description | No | A description of the sandbox (1000 or fewer characters), which helps you distinguish it from other sandboxes. |
| features | No | The add-on features to apply when creating or refreshing the sandbox. The features option is not needed when cloning a sandbox. Currently, the only valid value is ['SandboxStorage'], which increases the data storage available for Developer sandboxes from 200 MB to 400 MB and Developer Pro sandboxes from 1 GB to 2 GB. You can’t use this feature with Partial Copy or Full sandboxes. |
| historyDays | No | Full sandboxes only. Represents the number of days of object history to be copied in the sandbox. Valid values are -1 (all available days), 0 (default), 10, 20, 30, 60, 90, 120, 150, or 180. |
| licenseType | Yes (for sandbox creation) | Valid values are Developer, Developer_Pro, Partial, and Full. You can specify only one of these options: licenseType, sourceSandboxName, or sourceId. |
| sandboxName | Yes | A unique alphanumeric string (10 or fewer characters) to identify the sandbox. You can’t reuse a name while a sandbox is in the process of being deleted. |
| sourceId | Yes (for sandbox cloning) | A reference to the ID of the sandbox being cloned. You can specify only one of these options: licenseType, sourceSandboxName, or sourceId. |
| sourceSandboxName | Yes (for sandbox cloning) | Name of the sandbox being cloned. You can specify only one of these options: licenseType, sourceSandboxName, or sourceId. |
| templateId | Yes (for Partial sandboxes) | Optional for Full sandboxes. Not available for Developer and Developer Pro sandboxes. A reference to the sandbox template as identified by the 15-character ID beginning with 1ps in the URL when viewing a sandbox template in a browser. A sandbox template lets you select which objects to copy in a sandbox. |
Although you can place the sandbox definition file anywhere, we recommend keeping it in your Salesforce DX project in the config directory. When naming the file, we suggest providing a descriptive name that ends in sandbox-def.json, for example, developer-sandbox-def.json.
Here’s a sample definition file for creating a sandbox:
1{
2 "sandboxName": "dev1",
3 "licenseType": "Developer"
4}Here’s a sample definition file for cloning a sandbox:
1{
2 "sandboxName": "dev1clone",
3 "sourceSandboxName": "dev1"
4}Here’s a sample definition file for creating a sandbox with the features option:
1{
2 "sandboxName": "dev1",
3 "licenseType": "Developer" or "Developer_Pro",
4 "features": "['SandboxStorage']"
5}See Also