Newer Version Available

This content describes an older version of this product. View Latest

Create a Sandbox Definition File (Beta)

Before you can create a sandbox using Salesforce CLI, you must create 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.

As a beta feature, Salesforce CLI for sandbox operations is a preview and isn’t part of the “Services” under your master subscription agreement with Salesforce. Use this feature at your sole discretion, and make your purchase decisions only on the basis of generally available products and features. Salesforce doesn’t guarantee general availability of this feature within any particular time frame or at all, and we can discontinue it at any time. This feature is for evaluation purposes only, not for production use. It’s offered as is and isn’t supported, and Salesforce has no liability for any harm or damage arising out of or in connection with it. All restrictions, Salesforce reservation of rights, obligations concerning the Services, and terms for related Non-Salesforce Applications and Content apply equally to your use of this feature. You can provide feedback and suggestions for Salesforce CLI for sandbox operations in the Salesforce DX Trailblazer Community.

Note

Sandbox Configuration Values

Option Required? Description
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.
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.
historyDays No Full sandboxes only. Represents the number of days of object history to be copied in the sandbox.
Valid values:
  • -1, which means all available days
  • 0 (default)
  • 10
  • 20
  • 30
  • 60
  • 90
  • 120
  • 150
  • 180
licenseType Yes Valid values are Developer, Developer_Pro, Partial, and Full.
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.
sourceSandbox Yes (for sandbox cloning) Name of the sandbox being cloned.
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.

Sample Sandbox Definition File

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.

1{
2     "sandboxName": "dev1",
3     "licenseType": "Developer"
4}