Pull Declarative Changes From Your Scratch Org

In this exercise, you will…

  • Run force:source:pull using the integrated terminal in VS Code
  • If force:source:pull gives an error, use this workaround
  • Examine the results of a successful force:source:pull

Run force:source:pull using the integrated terminal in VS Code

Now that you’ve done development work in your scratch org, it’s time to pull those changes back into your local Salesforce DX project. That’s what force:source:pull is for.

Execute this command:

sfdx force:source:pull 
Salesforce DX Command / Flags Description
force:source:pull Pulls changed source from the scratch org to your project to keep them in sync.

After executing the above, your terminal should look something like this:

Important: If you get an error running force:source:pull it’s likely due to a bug in Winter’19 scratch orgs. Please see the next set of instructions for a workaround.

If force:source:pull gives an error, use this workaround

The Winter ‘19 release has seen a lot of odd (and painful) bugs. If you got an error when you executed force:source:pull, this workaround should be able to help get you running again.

  1. If you see this error, you will need to add a line to your project’s .forceignore.
  2. Click on the .forceignore file in the VS Code Explorer.
  3. Add AppSwitcher.appMenu to the .forceignore file, directly below the entry for package.xml.

Examine the results of a successful force:source:pull

If your force:source:pull command was successful, you’ll have a number of new files in your project. Here’s a tour of what came down from your scratch org.

  1. The custom Lightning App that you created.
  2. The flexipage that is used for the Travel Expense record home.
  3. The new Approved custom field.
  4. The new Permission Set you created.
  5. A bunch of profiles that came unintentionally (we’ll have to deal with them in a minute)
  6. The custom Travel Expenses tab.

Updated: