(upbeat music)
- Hello.
My name is Kevin Poorman, and I'm a developer evangelist
here at Salesforce.
Today we're gonna work on installing the Salesforce CLI,
Visual Studio Code,
and the Visual Studio Code Extension Pack
for Salesforce Development.
(blows) That's a mouthful.
Finally, we're gonna connect to a Sandbox
and pull down metadata like classes and triggers.
Before we start with Visual Studio Code however,
we need to install Java.
Java is a prerequisite of the extension pack.
So let's go ahead and install it.
I'm choosing to install the JDK from AdoptOpenJDK,
but your company may have a specific JDK
that they want you to install.
I'm going to go ahead and click on the latest release
and let that download.
Now this is a fairly sizable package,
so it may take a minute.
Once it's downloaded, I'm gonna go into my downloads folder,
and double-click on the installer.
Use the defaults to install it.
Now we'll want to install the Salesforce CLI.
To do that, I've navigated to the download page,
and I'm going to click download for Mac OS.
This will download fairly quickly.
Once it's downloaded, I can double-click on it to open.
Through the magic of television,
I have made the install go much faster.
And I'm gonna go over to my command line and test it out.
To do that, I'm just gonna type in SFDX and hit Enter.
And this will give me the version information
and tell me exactly what I'm running on.
So I know that the Salesforce CLI
is working as expected.
Now it's time to install Visual Studio Code.
I searched for "download Visual Studio Code",
and it's taken me to this page.
I'm going to click on the Mac icon
and it will download fairly quickly.
Once downloaded, I'm going to go
back into my downloads folder.
Now Visual Studio Code downloads as a zip file,
so I'm going to double-click on it to expand it.
Now that I've seen it expand,
I'm gonna click on the application
and drag it over to my Applications folder.
Now this is where the fun really starts.
Let's open up Visual Studio Code.
It's going to ask me if I really want to open it because,
as it turns out,
I just downloaded Visual Studio Code from the internet.
And yes, yes I do.
To recap, so far, we've installed Java,
the CLI and Visual Studio Code.
Now the fun starts.
Let's install the Visual Studio Code Extension Pack
for Salesforce Development.
I'm going to go ahead and maximize my screen,
but that's totally optional.
Now I'm gonna click on the extension icon,
which is this little block shape over here on the left.
And this will show me a bunch of popular extensions
for Visual Studio Code.
I'm going to click on the search bar however,
and type in Salesforce.
The second one that comes up
is the Salesforce Extension Pack.
I'm going to go ahead and click on it
so that I see that the full title
is the Salesforce Extension Pack.
Now you just need to click install.
Now this can take a little while,
because the extension pack is actually made up of
seven individual extensions.
We're going to make this go faster with some TV magic,
and now that we've installed the extensions,
let's put them to use.
I'm going to create a new Salesforce project,
and to do that, I'm gonna use the command palette,
and that's hitting Command-Shift-P,
which will bring up this little window.
This is the command palette.
It's a powerful and quick interface
to virtually any and all functionality
that Visual Studio Code can do.
You simply need to type,
and it will provide a list of fuzzy search results.
For instance, if I type in "create",
it'll show me various options.
I'm going to choose Create New Project,
and then I'll fill in the rest of these details.
I want a standard project, I'm going to give it a name.
It's gonna ask me where to put it.
I'm gonna put it on my desktop.
Once it's done creating the project,
Visual Studio Code will reload the window.
Over on the left, the explorer lists
all of our metadata files for our project.
We haven't connected it to an Org,
so we don't have any metadata yet.
So let's go ahead and authorize an Org to do that.
To do that, I'm going to hit
the Command-Shift-P again,
the command palette, and type in, "Authorize an Org".
That'll ask me where I want to log in.
Now the project default is to log into Production,
but I could also choose Sandbox,
or even put in a custom my domain URL.
I'm going to use this as my alias demo.
And then I'm gonna choose the extension pack,
we'll open the Org in Chrome, and I can log in,
through the web browser.
Once I'm logged in, I can close this Chrome tab.
Now as we switch back over to Visual Studio Code,
it'll you show down here that Authorize successfully ran.
I'm going to close that notification window.
Having authorized to an Org gives us two new icons
over here on the left icon bar.
The first is the Test browser,
and it's represented by this little flask.
You can run your unit tests from there.
The second icon is the Org browser,
and it kinda looks like a cloud.
If we click on the Org browser,
we can see all the metadata types for our Org.
I'm going to choose Apex Classes.
And by clicking on the little cloud icon
next to a piece of metadata, or even a group of metadata,
we can tell Visual Studio Code to download those files
to our local project.
Now, when I go over to my file explorer here,
and dive into force-app/classes, we can open up a class.
Visual Studio Code, in conjunction with the extension pack,
gives you syntax highlighting and a host of other tools
perfect for Salesforce Development.
Additionally, if I modify this file, and save it,
I can then push this change back to my Org.
So as a recap, today we installed Java,
the CLI and Visual Studio Code.
We also installed the Salesforce Extension pack
for Visual Studio Code Development.
And we created a project and authorized to an Org,
we pulled down some metadata for local editing,
we edited that file, and then we pushed that change
right back to the Org.
Now you're all set up to use Visual Studio Code
for Salesforce Development.
Thanks for watching.
If you learned something, be sure to like this video.
If you want to get more content like this
pushed directly to you, click subscribe and that bell,
to get notifications.