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

5 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
  3. You wont believe you made a miracle in my life, I was literally struggling to fix Salesforce DX on my system for last 2 weeks , this simple document of yours has literally fixed my issue

    saying Thank you would be very small thing ,I just cant express my happiness

    Thank you so muchhhhhhhhhhhhhhhhhhhhhhhhhh :)))))))))))))000000

    ReplyDelete
  4. Thank you for taking the time and sharing this information with us. It was indeed very helpful and insightful while being straight forward and to the point.
    Java Training in Chennai
    Java course in Chennai
    Angularjs Training in Chennai
    Selenium Training in Chennai
    German Classes in Chennai
    Java Training in Anna Nagar
    Java Training in Velachery

    ReplyDelete

Powered by Blogger.