VS Code + SFDX

Updated 2 weeks ago by Copado Solutions

Prerequisites

In order to configure Visual Studio Code and SFDX to work with the Copado CLI, you need the following elements:

  • Visual Studio Code.
  • Salesforce Extension Pack Extension.
  • A Copado Git Repository record in DX source format.

Setup

  1. Make sure you have a .gitignore file in the root of your repository that contains the following folders/files (this is the .gitignore file that VS Code writes + Copado exclusions): .gitignore.

  1. Use Git to clone the repository to any folder:

  1. Go to VS Code, open the Command Palette and select SFDX: Create Project:
  2. Set the same name as the folder name created when the repository was cloned:
  3. Select the parent folder where the Git repository was cloned:

  1. VS Code will show a warning: “A folder with the specified project name already exists in the selected directory. Do you want to overwrite it?”. Accept this
  2. If you get this error “ERROR running force:project:create:  A name parameter is required to create a storage”:
    1. Create a file in the same path as the project folder package.json.
    2. Add the following body and repeat step 5:

  1. VS Code will open a new window and will override some files, like the .gitignore file that was already configured in step 1. Right-click and discard the changes for the following files:
    1. .gitignore
    2. .forceignore
    3. sfdx-project.json
    4. README.md (if exists)

  1. Open the Command Palette and select SFDX Authorize an Org:

  1. Select your org type:

  1. Give a name to the developer org/sandbox :

  1. This will prompt you to the web authentication, use your credentials to log in.
  2. You can save the changes to the server by doing right click on the changed metadata and selecting SFDX Deploy Source to Org:

You are all set to start using the Copado CLI!


How did we do?