RSS

Salesforce – Create Scratch Org using Sfdx CLI

23 Aug

Hi folks,

Here are steps to create Scratch org using SFDX CLI Commands.

  1. Open Visual Studio IDE , go to Terminal and execute the below sfdx CLI commands.

Note: sfdx cli installation should be done.

2. Connect to the DevHub Org using the below command

sfdx force:auth:web:login -d -a devHub

Login with Username / Password

After successfully connected to DevHub Org

3. Create a salesforce project in the VS Code using the below command

Cmd + Shift + P

Create a Project with manifest

Enter the Project name

(OR)

sfdx force:org:create -f config/project-scratch-def.json -a demoorg1

Once the project created successfully, will able to see the below message
Successfully created scratch org: 00D0x0000009IeHEAU, username: test-xifpnzrvzjnt@example.com

4. Verify to which org, you are connected using below command
sfdx force:org:display -u

To see the list of orgs connected, execute the below command
sfdx force:org:list

5. To retrieve the metadata

sfdx force:source:retrieve -u -p force-app

6. Verify the source code folder force-app

References:

Create and Test Our Scratch Org – trailhead

Salesforce Source-Driven Development and Scratch Org

Getting started with Salesforce @SFDX – Udemy

https://dev.to/toadgeek/salesforce-dx-useful-cli-commands-52k

sfdx force:doc:commands:list
=== Commands
force:alias:list # list username aliases for sfdx
force:alias:set # set username aliases for sfdx
force:apex:class:create # create an apex class
force:apex:execute # execute anonymous apex code
force:apex:log:get # fetch a debug log
force:apex:log:list # list debug logs
force:apex:test:report # display test results
force:apex:test:run # invoke apex tests
force:auth:jwt:grant # authorize an org using the jwt flow
force:auth:sfdxurl:store # authorize an org using an sfdx auth url
force:auth:web:login # authorize an org using the web login flow
force:config:get # get config var value(s) for given name(s)
force:config:list # list config vars for sfdx
force:config:set # set config vars for sfdx
force:data:bulk:delete # bulk delete records from a csv file
force:data:bulk:status # view the status of a bulk data load job or batch
force:data:bulk:upsert # bulk upsert records from a csv file
force:data:record:create # create a record
force:data:record:delete # delete a record
force:data:record:get # view a record
force:data:record:update # update a record
force:data:soql:query # execute a soql query
force:data:tree:export # export data from an org into sobject tree format for force:data:tree:import consumption
force:data:tree:import # import data into an org using sobject tree api
force:doc:commands:display # display help for force commands
force:doc:commands:list # list the force commands
force:lightning:app:create # create a lightning app
force:lightning:component:create # create a lightning component
force:lightning:event:create # create a lightning event
force:lightning:interface:create # create a lightning interface
force:lightning:lint # Linter for Lightning Components
force:lightning:test:create # create a lightning test
force:lightning:test:run # invoke lightning component tests
force:limits:api:display # display current org’s limits
force:mdapi:convert # convert metadata api source into the sfdx source format
force:mdapi:deploy # deploys metadata to an org using metadata api
force:mdapi:retrieve # retrieves metadata from an org using metadata api
force:org:create # create a scratch org
force:org:delete # mark a scratch org for deletion
force:org:display # get org description
force:org:list # list all active orgs you’ve created or authenticated to
force:org:open # open an org in your browser
force:package1:version:create # create a new package version in the release org
force:package1:version:create:get # retrieve status of package upload request
force:package1:version:display # display details about a package version
force:package1:version:list # list package versions for the specified package or for the org
force:package:install # install a package in the target org
force:package:install:get # retrieve status of package install request
force:project:create # create a new SFDX project
force:project:upgrade # update project config files to the latest format
force:schema:sobject:describe # describe an object
force:schema:sobject:list # list all objects of a type
force:source:convert # convert sfdx source into the metadata api source format
force:source:open # edit a lightning page with lightning app builder
force:source:pull # pull source from the scratch org to the project
force:source:push # push source to an org from the project
force:source:status # list local changes and/or changes in a scratch org
force:user:password:generate # generate a password for a scratch org
force:user:permset:assign # assign a permission set to the admin user of an org
force:visualforce:component:create # create a visualforce component
force:visualforce:page:create # create a visualforce page

View at Medium.com

Happy Learning!!

Keep watching this space for more updates

Have a nice day 🙂

 
1 Comment

Posted by on August 23, 2019 in Uncategorized

 

One response to “Salesforce – Create Scratch Org using Sfdx CLI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: