Scratch orgs, like development sandboxes, don’t include data when created. Because scratch orgs are typically created and dissolved on a daily basis, quickly and easily adding data to and deploying data from scratch orgs is critical for developer productivity. Prodly provides a Salesforce DX plugin so Salesforce developers can easily seed their scratch orgs with data and/or deploy data to and from any Salesforce environment directly using the sfdx command line interface.
The plugin allows you to deploy data between these environment types for any environment you have credentials to access:
- From a developer hub (dev hub) org to a scratch org.
- From any environment to a scratch org.
- From a scratch org to any environment, except a dev hub org.
- From any non-scratch org to any non-scratch org.
Some example use cases:
- Copy a subset of data from an existing production environment to a scratch org for testing purposes.
- After developing and testing an application using scratch orgs, deploy the changes to a centralized sandbox.
- Mimic the typical environment-to-environment deployment you do from the Release user interface.
- Many other possibilities…
Related Projects and Packages:
- Github Project: https://github.com/prodly/appopsdxcli
- NPM Package: https://www.npmjs.com/package/appopsdxcli
To properly set up your environment for using the plugin:
- Follow the instructions in the Salesforce DX Setup Guide to enable the Salesforce Developer Hub (dev hub) in your production or business environment.
- Follow the instructions in the Install the Managed Package topic of Prodly Release to install the Prodly managed package in your dev hub org. The dev hub org must be the control environment.
- Install the Prodly Salesforce DX plugin using the command: sfdx plugins:install appopsdxcli
sh-3.2# sfdx plugins:install appopsdxcli This plugin is not digitally signed and its authenticity cannot be verified. Continue installation y/n?:
This is due to a Salesforce limitation, it does not yet support signing a plugin with a certificate. The suggestion is to click “y” to continue.
- Use the Salesforce DX command-line interface (CLI) to authorize your dev hub org.
- Use the Salesforce DX (sfdx) CLI to create your scratch orgs.
- Optionally, use this command to set a default dev hub username:$ sfdx force:config:set defaultdevhubusername=<devhubusername_or_alias> –global
- Optionally, use this command to set a default scratch org username:$ sfdx force:config:set defaultusername=<username_or_alias> –global
- Before accessing each environment (from production to full sandbox to scratch org) relevant to your use case for the very first time, either add the environment on the Environments page in the UI or use the appops:manage -m command to connect Release to the environment from the command.
If you encounter errors deploying to a scratch org either after initial creation or after your session times out, run this command:$ sfdx force:org:open – u
Prodly’s Salesforce DX plugin consists of these commands:
- appops:checkin – saves data from a Salesforce environment to a version control system (VCS) repository branch.
- appops:checkout – deploys data from a VCS repository branch to a Salesforce environment.
- appops:deploy – deploys data from one Salesforce environment to another Salesforce environment.
- appops:manage – authorizes a Salesforce environment for use by the plugin.