I get frustrated trying to get this VS Code thing off the ground. It is like someone says "Fly to Dreamforce" and I'm still trying to figure out what an airplane is.

I've got VS Code installed. JDK installed. Salesforce CLI installed. Salesforce Extensions installed. I got my fingers crossed. It doesn't work for me - it doesn't do anything. I try "Create Project with Manifest" and it just sits there - nothing happens.

Anyone know of a place to go to that takes it from the beginning, from kindergarden, and steps you through the process rather than starting at 10th grade?

  • 1
    Do you want to use it with DX or directly with a regular sandbox? – David Cheng Nov 8 at 20:11
  • regular sandbox – Dean Wooldridge Nov 9 at 20:16
  • VS Code must be alive as I discovered the Create Project with Manifest command does something - IF you don't have a project open. How I got to an open project - you got me. Just a little gotcha. – Dean Wooldridge Nov 9 at 20:21

There's a handy video you can watch on Getting Started in VS Code with Salesforce DX.


Getting Started

First things first: it's important to note that VS Code places extension prompts at the very top of the screen, instead of the more usual center of the screen. You'll need to pay attention to these dialogs, which are not immediately obvious. Once you get used to this, you'll find that Code is not that hard to use, it's just different than most other IDEs.

To make a new DX project, choose the Create Project from Manifest command, and you'll see a small text area at the top that says "Enter project name (Press 'Enter' to confirm or 'Esc' to cancel)." Type in the name you'd like to use for your project (it can be any reasonable text).

Next, you'll get a Folder Selection dialog. Choose a place you'd like to save your project. It's helpful if you've already created a workspace folder to store all your projects in, such as c:\users\your.name\workspace\. Once you select the folder, you'll see a brief progress dialog, after which your project will be ready.

Once you do this, you'll probably want to Authorize a Dev Hub org. There are steps you must follow to enable Dev Hub functionality before you can use this command. The Dev Hub can be a Developer Org or your Production Org. This is optional, but if you do not do this, you won't be able to create scratch orgs. If you're just using a sandbox or developer edition, you can choose Authorize an Org instead.

Again, pay attention to the dialog at the top of the screen. You'll want to enter an alias (strongly recommended), which is simply a nickname for the org you're authorizing. After that, you'll be prompted to log in through your default browser. Once logged in, you can go back to Code.

If you're using Scratch Orgs, you can create a new Scratch Org, which will take a preferences file (one was created in your project automatically) and an alias. After about a minute, you'll have a new, empty org. Everything else from there is just development; you can use the DX commands to create new classes, pages, components, etc, or you can manually create the source files if you prefer.

Or, you can log in to the scratch org, make changes there, and use SFDX to pull changes down to your computer. Choose whichever works best for you. You'll notice when you create a scratch org that you have no username or password; this is fine by default, as you can just choose "Open Default Org" to go to the scratch org you created. Note that not all DX commands and options are exposed, so you might need to use the Terminal from time to time.

To do this, just click on the Terminal tab, and you can use the sfdx command with all its options. You can check the Salesforce CLI Command Reference for a full list of commands and options available. You'll also want to read more about the configuration options for your scratch orgs and other settings, but this should at least help you get started.

Also, feel free to Get Started with Salesforce DX over on Salesforce Trailhead for more DX basics. These are not VS Code specific, but will help you understand the intended development cycle.

  • @Raul Thank you for fixing the typo! I somehow missed this during my proofreading. – sfdcfox Nov 8 at 19:37
  • Nice answer, curious to know if it is only me or push to DX is very slow? – Raul Nov 8 at 19:42
  • 1
    @Raul It depends on the number of files involved on your file system. It can take a few seconds to a few minutes. It's definitely noticeably slower than Force.com IDE is/was, but it's also a lot better at detecting many changes. Just like building a repo, the first push is always the longest; subsequent pushes should be much faster, as it checks for local disk diff changes, but this still takes more time than other IDEs that just deploy the changed file directly. – sfdcfox Nov 8 at 19:48
  • @Raul it also depends on the type of development, DX is perfect for ISV, but for any mature org, the idea of splittling stuff into packages is almost non-sensical, might as well trash the whole org and start over. But when it does work seems amazing. – Ralph Callaway Nov 9 at 9:13
  • @Raul vs code is a true text editor so it's pretty sweet once you get moving, although truthfully i'm still on sublime text 3 using an old version of mavensmate (which hasn't been supported for at least a year now). – Ralph Callaway Nov 9 at 9:14

For personal projects with developer edition (and/or if you are putting off looking at 'projects'), ForceCode is an extension that may be considered easier to use.

  • 1
    ForceCode is legacy and unmaintained, though. I'm not sure it's wise to adopt it on new projects. – David Reed Nov 14 at 12:27
  • I'm using the ForceCode plug-in too to work with Salesforce Code (not DX). – Mimica Nov 14 at 22:14
  • @DavidReed Yes, the plugin was not maintained for some time, but I believe it is back in action from another developer. – Prashanth K 2 days ago
  • @PrashanthK I stand corrected! Thank you for the pointer. – David Reed 2 days ago

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.