Push and Pull Source

Salesforce DX can be used to create any number of Scratch Orgs in your Dev Hub. The Metazoa Snapshot Org Management product can launch these Scratch Orgs in the browser, and also Push and Pull Source from any Salesforce DX Scratch Org. This technology enables developers to create Source Driven Projects on their local machine with Salesforce DX.

Push and Pull Source
with Salesforce DX Scratch Orgs

After you do an initial push, Salesforce DX tracks the changes between your local file system and your Scratch Org. If you change your Scratch Org, you usually want to pull those changes to your local project to keep both in sync. During development, you change files locally in your file system and change the Scratch Org using the builders and editors that Salesforce supplies. Usually, these changes don’t cause a conflict and involve unique files.

Metazoa Snapshot has visual tools to Push and Pull Source from a Salesforce DX Scratch Org. You can select an existing Scratch Org or create a new one at any time. The tools display information about local assets in the project folder that could be pushed to the Scratch Org, and remote assets in the Scratch Org that could be pulled down. The Source Push button will deploy any local adds to the currently selected Scratch Org. The status list will update after the metadata deployment. The Source Pull button will retrieve any remote adds from the currently selected Scratch Org. The status list will update after the Metadata is retrieved and the local project is updated.

The Push and Pull Source command works with Scratch Orgs only. If you’re synchronizing source to any other Org, use the Metadata API. By default, only changed source is synced back to your project. The pull command does not handle merges. Projects and Scratch Orgs are meant to be used by one developer. Therefore, we don’t anticipate file conflicts or the need to merge. However, if the pull command detects a conflict, it terminates the operation and displays the conflict information. The short movie below shows how to Push and Pull Source to a Salesforce DX Scratch Org.

Pushing and Pulling Scratch Orgs with Snapshot

Overview

This document guides users through the process of using Metazoa Snapshot to push and pull source between a local Salesforce DX project and a scratch org. It explains how to create a scratch org, push and pull assets between the local project and scratch org, and utilize additional options for handling metadata types and overwriting configurations.

Prerequisites

  • Metazoa Snapshot account
  • Salesforce DX account
  • Basic understanding of Salesforce DX projects

Procedure

Step 1: Create a Salesforce DX Developer Project

  1. Launch Metazoa Snapshot.
  2. Navigate to the Deployment Pipeline section.
  3. Create a new Salesforce DX developer project by selecting a parent folder (e.g., Documents folder) and providing a name for the project.
  4. Ensure that the project is in Salesforce DX file format.

Step 2: Populate the Salesforce DX Project

  • Through the Metazoa Snapshot interface, you have the option to populate your project with assets such as:
    • Downloading packages.
    • Using a job list.
    • Using a Snapshot limits file.
For the purpose of this guide, we will proceed directly to the push and pull source operation.

Step 3: Navigate to Push and Pull Source Tab

  1. Go to the Push and Pull Source tab in Metazoa Snapshot.
  2. From the drop-down menu, select an existing scratch org or create a new one by clicking the “Create” button.
  3. If creating a new scratch org, provide a username for the scratch org.

Step 4: Add an Apex Class to the Project

  1. Navigate back to the Salesforce DX project tab.
  2. Right-click in the project area and select the option to create a new Apex class.
  3. This will add the Apex class to the classes folder in the project.
  4. You can also open your project folder to view the classes on your local computer.

Step 5: Push Source to Scratch Org

  1. Return to the Push and Pull Source tab.
  2. Click the “Refresh” button to update the status.
  3. The status should indicate a local addition of the Apex class.
  4. Click the “Push” button to push the Apex class to the scratch org.
  5. The status should now indicate a remote addition, which signifies that the class was added to the admin profile in the scratch org.

Step 6: Make Changes in Scratch Org

  1. Launch the scratch org in a remote browser.
  2. Navigate to Setup within the scratch org.
  3. Create an object and add a field to it.
  4. Save your work in the scratch org.

Step 7: Pull Source from Scratch Org

  1. Return to the Metazoa Snapshot Push and Pull Source tab.
  2. Click the “Refresh” button to update the status.
  3. The status should indicate a remote addition of the object and field you created.
  4. Click the “Pull” button to pull the changes from the scratch org to your local Salesforce DX project.

Step 8: Additional Options

  • The Push and Pull Source tab offers additional options:
    • Ignore Metadata Types: Allows you to specify metadata types that should not be pushed to the scratch org.
    • Force Overwrites and Ignore Warnings: Facilitates smoother operation for complex projects by enabling you to force overwrites and bypass warnings during push and pull actions.

Conclusion

By following these steps, you can effectively utilize Salesforce DX scratch orgs to push and pull source between a local project and a scratch org using Metazoa Snapshot. This is especially useful for developing and testing Salesforce configurations and customizations in an isolated environment before deploying them to production

Learn More!

Snapshot provides powerful tools for Salesforce Administrators that help manage the change and release process, visualize org complexity, improve security and compliance, and lower the total cost of Org ownership. Visit the AppExchange to start a 14 day free trial or click the button below to schedule a demo.

🎉 Congratulations! 🎉

You’ve successfully completed the Metazoa Metadata Studio Certification Class. With the skills you’ve acquired, you’re now adept at harnessing the power of Metazoa’s Metadata Studio, seamlessly integrating artificial intelligence into Salesforce org management. You have earned you a certificate! Well done, and we wish you continued success in your future endeavors!