Salesforce DX

Creating Scratch org using CLI - Salesforce DX

Creating Scratch org using CLI - Salesforce DX

Creating Scratch org using CLI - Salesforce DX

To know about scratch Orgs and the prerequisites required to create Scratch org refer to the previous post-  http://www.worldofsalesforce.com/2017/11/introduction-to-salesforce-dx.html

In this post, we will try to create a scratch org and push configuration and Metadata to it using CLI.

Let's start by creating a project on our local machine. Open the command prompt and type the below command.

mkdir my_WOS_project  
cd my_WOS_project

The above command will create a folder called my_WOS_project and change the active directory to it.

Now we will clone a project from the GIT repository. 
git clone https://github.com/worldofsalesforce/ScratchOrgDemo

now lets change directory to ScratchOrgDemo
cd ScratchOrgDemo

now let's create scratch org and name it as MyOrg using the below command
sfdx force:org:create -s -f config/project-scratch-def.json -a "MyOrg "

after few seconds you would see the message containing the scratch org Id 
and username.




To open the newly created scratch org using CLI type
sfdx force:org:open


lastly, we will push the repository we cloned to the scratch org using CLI
Simply type
sfdx force:source:push

once the metadata is pushed to the org, open the org again to see the changes.
A classic app called Scratch org demo would be present with the visualforce tab . 
See video for step by step instructions.




About Saurabh Dua

2 comments:

  1. Awesome information.
    Thanks for posting.. Keep updating new things.
    Salesforce Lightning Training

    ReplyDelete
  2. Hi Saurabh,


    when I try to create the scratch org by the following command sfdx force:org:create -s -f config/project-scratch-def.json -a "MyOrg "
    I get the following error
    You do not have access to the [ScratchOrgInfo] object.....
    Can you help Me solve the problem.... I have cloned the repository

    ReplyDelete

Powered by Blogger.