Create Salesforce scratch org using VS Code
2K views
Jan 8, 2025
Pre-Requisites to create Salesforce scratch org using VS Code: 1. VS Code. 2. project-scratch-def.json file in VS Code. Blog Post: https://www.infallibletechie.com/2022/11/how-to-create-salesforce-scratch-org-using-vs-code.html
View Video Transcript
0:04
foreign
0:09
in this video we are going to see how to
0:12
create scratch org
0:15
in Salesforce using vs code
0:19
since I'm going to use vs code for
0:23
creating scratch arcs vs code is
0:26
prerequisite and you should also install
0:30
Salesforce
0:33
CLA tool these two are very important so
0:37
make sure these two are
0:39
installed in your PC and also make sure
0:43
the environment variables are the path
0:45
variables are set properly in your PC if
0:50
you run into any issues after the
0:52
installation make sure
0:54
the PC is restarted once you restart uh
1:00
it will make sure the installation
1:03
um
1:05
connectivity to the directory from the
1:08
environment environment variables are
1:11
properly set
1:12
okay so I assume that
1:15
vs code is installed and Salesforce CLI
1:20
is also installed
1:22
in order to create a scratch organ
1:26
Salesforce we should have a Dev Hub so
1:29
Dev Hub is nothing but an org Salesforce
1:33
org
1:34
from which we will be creating the
1:38
scratch arcs
1:41
so we cannot simply create a scratch
1:44
orgs we should know the source this
1:47
source is not for metadata or anything
1:49
like that you can also use use for that
1:51
but if you even want to create a
1:55
clean scratch org then also we need an
1:58
org so that Salesforce knows that from
2:02
here only we are creating all the
2:04
um
2:05
arcs so
2:08
in order to do that first go to Dev Hub
2:11
in Salesforce setup
2:14
and make sure enable Dev Hub is
2:18
enabled
2:23
and the next step is go to vs code
2:28
and
2:31
create a project
2:33
I used a manifest
2:36
command create a project with manifest
2:39
and then I authorized my org
2:44
and the next step is we have three steps
2:49
to create a scratch Arc the first step
2:52
is
2:53
we have to set default Dev Hub username
2:57
so whenever we run any command related
2:59
to Dev Hub this is the username it will
3:01
take
3:03
so this is the example sfdx Force config
3:07
set def default Dev Hub username is
3:10
equal to the username of the
3:12
Arc
3:14
so this is the org and this is the
3:17
username for that particular Arc so I
3:19
ran this
3:21
and then it successfully set default Dev
3:25
Hub username for my
3:28
org
3:30
so the first step is done
3:33
the next step is
3:37
we have to use the following
3:40
command to login and set the dev Hub org
3:45
and Alias so we have to make use of this
3:50
command so that we authenticate into
3:52
this particular Arc and then we are
3:55
going to set an alias so here I am going
3:57
to set Alias as Dev hub
4:00
so let's run this command
4:04
so we have only three commands so that
4:07
our scratch org should be ready
4:40
so successfully
4:41
it authenticated
4:44
and the final step is we have to
4:48
create an scratch org in order to create
4:51
this scratch Arc you should have project
4:54
iPhone scratch iPhone def.json file here
4:59
you have to Define what should be the
5:01
org name what should be the addition
5:02
what are all the features you want to
5:04
enable
5:05
so here I'm enabling enabling Omni
5:08
Channel and also communities
5:11
Salesforce experience Cloud does nothing
5:13
but communities
5:17
if you wanted to have additional
5:19
features or refer Salesforce
5:22
articles and then add it
5:26
so I'm going to execute this command so
5:29
that it will create a scratch org for me
6:06
okay yeah the problem was
6:10
I am in chat org but I have to go to
6:13
config so
6:21
so now I have to run this query
6:37
yeah it is creating a scratch org for me
6:40
it will give you
6:41
two important informations so we have to
6:45
make a note of it one is Arc ID and the
6:48
other name is username
6:49
so this is the org ID and this is the
6:51
username
6:52
there are additional commands which are
6:54
available so that you can set
6:57
password also for this and then you can
6:59
also login into the org
7:23
okay if you go to active scratch arcs
7:28
tab
7:29
we can find that particular scratch org
7:32
which got recently created
7:44
so we have to use these three commands
7:47
to Simply create a
7:50
scratch organ Salesforce
7:52
please check that video description
7:55
I have shared my blog link from which
7:58
you can get
8:00
these commands and also
8:02
screenshots as a reference
8:05
also I have shared this project scratch
8:09
definition file using which you can
8:12
easily
8:14
create a scratch organ Salesforce using
8:17
vs code
8:27
I hope it was helpful
8:37
thank you for watching
#Business & Industrial
#Development Tools
#Enterprise Technology
#Internet Software