Retrieve Salesforce Metadata into VS Code

Steps:

  1. Open VS Code with SFDX extensions installed

  2. Set up a new project folder
    a. Hit Ctrl-Shift-P on Windows or Cmd-Shift-P on Mac
    b. Run command: SFDX: Create Project with Manifest
    c. Select Standard
    d. Choose a name for the project folder and place it in a convenient location

  3. Authenticate into your org
    a. Hit Ctrl-Shift-P on Windows or Cmd-Shift-P on Mac
    b. Run command: SFDX: Authorize an Org
    c. Choose Production for production and Trailhead orgs, Sandbox for sandbox orgs
    d. Select a name for the org or accept the default
    e. Enter your credentials to the org
    f. Grant access to “Salesforce CLI” when prompted

  4. Select the metadata to retrieve
    a. Click the Cloud icon in VS Code, the “Org Browser”
    b. If necessary, click the “Refresh” icon
    c. Select the metadata type you want to retrieve, for example, Apex Classes
    d. Click the small cloud icon next to that metadata type
    e. If you get an error, try re-launching VS Code
    f. After the retrieve operation successfully completes, switch back to the File Explorer

Done - now you can edit the metadata locally and deploy back to the org by right-clicking the component, then selecting SFDX: Deploy Source to Org