Salesforce DX Absolute Beginner ( Part 6 Of 7 )

In this sixth part of the salesforce DX series, In this post, I am going to explain how to migrate changes from the scratch org to salesforce sandbox for testing.  When you’re ready to validate your source, convert your Salesforce DX source to Metadata API source format. You can then deploy to a sandbox.You can deploy or retrieve up to 10,000 files at once. The maximum size of the deployed or retrieved .zip file is 400 MB (39 MB compressed). If either limit is exceeded, the operation fails.You can increase the efficiency of your sandbox and production deployments by using tests you’ve already done in the scratch org. Run only the tests that are required, such as tests for Apex classes and triggers that change for the deployment. To run only specified tests when you deploy, set -l to RunSpecifiedTests and use -r to specify a comma-separated list of tests for deployment-specific changes to your Apex code.
  1.Pull Changes from Scratch Org 

To ensure that your project is up to date, synchronize the source in your local file system with your development scratch org by running the pull command.


2.Login to the sandbox

Login into the sandbox by running the following command. Set alias name so that you can refer it easily for further.

3.Convert Salesforce DX project into metadata project

create the directory for your source and convert the source to Metadata API format as shown below

4.Deploy Metadata into Sandbox 

Deploy the metadata from the directory to the sandbox, specifying deployment-specific tests as needed by running this command.

If your deployment exceeds the wait time before it completes, use force:mdapi:deploy:report to check the deployment status. The default wait time is 0 minutes. Use the –wait parameter to specify a longer wait time.

For example, to check a deployment job and add 5 more minutes to the wait time

Quick Recap of part 6 before going to part 7

  • Pull Changes from scratch org
  • Login to sandbox
  • Convert DX project to salesforce metadata.
  • Deploy changes to the sandbox.