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

3 comments:

  1. 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
  2. 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
  3. Hi On open the scracth org after putting code, it throws this error: This page has an error. You might just need to refresh it.
    [NoErrorObjectAvailable] Expected identifier
    throws at https://customer-power-6339-dev-ed.lightning.force.com/l/%7B%22mode%22%3A%22PROD%22%2C%22app%22%3A%22one%3Aone%22%2C%22fwuid%22%3A%225fuxCiO1mNHGdvJphU5ELQ%22%2C%22loaded%22%3A%7B%22APPLICATION%40markup%3A%2F%2Fone%3Aone%22%3A%22reWqa6cwVOwpCH85HSCicA%22%7D%2C%22mlr%22%3A1%2C%22pathPrefix%22%3A%22%22%2C%22dns%22%3A%22c%22%2C%22ls%22%3A1%2C%22ct%22%3A1%7D/inline.js?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..TC__XaKDP04f1XZPywPyN0WNVDYNdA5iA7lJlvxkh6A:146:17

    ReplyDelete

Powered by Blogger.