So it’s time to learn about Scratch Orgs. I know about them, but don’t know HOW to do them.
I have all my VSCode environment set up and I have a Dev Hub. My goal is to get the Dreamhouse App installed on a pre-release org (a few days after the release to Sandboxes).
I google getting started with scratch orgs and find this video https://www.youtube.com/watch?v=RJWZD2qO0Cw. Nope, this does not start at the beginning. It jumps straight to having a config file pre-set. Where do I get a config file? where do I save the config file? when do I set up my git repo?
Next Stop Trailhead https://trailhead.salesforce.com/content/learn/projects/quick-start-salesforce-dx/set-up-your-salesforce-dx-environment
OK, this is getting somewhere.
Set up the Scratch Org
First step log into the dev hub
sfdx force:auth:web:login -d -a DevHub
I’m following the trailhead because I want the Dreamhouse app, so that starts with a Git Clone so doesn’t help me set up a good process for setting up git in the first place. But it looks like Git Clone does make the folder git enabled, which is good.
Next step is that I connected my local Git folder to my Bitbucket via SourceTree, and checked out a branch to work on. (See my VS Code for Non Developers page to get help on how to do this part). So now we can start working. (Until I have everything set up, and backed up to the cloud, I don’t like to start).
I need to make one change to my project-scratch-def.json file to make it a preview release developer org.
"release": "Preview",
I run the command to create the Scratch Org, with the alias of JMDemo
sfdx force:org:create -s -f config/project-scratch-def.json -a JMDemo
hmm, error.
At this time, we are outside of the preview period. You can create only current release scratch orgs.
Even though I’m within the dates of the preview as specified here https://developer.salesforce.com/docs/atlas.en-us.220.0.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_version_selection.htm
So I start again without the Preview Org and run the command and I have a scratch org.
Open the scratch org with
sfdx force:org:open
And push the metadata in my folders in my local machine via
sfdx force:source:push
Then assign the perm set and import the data as per the trailhead module so I can get Dreamhouse app up and running.
sfdx force:org:open
And there it is, Dreamhouse app ready to go.
Now, Commit to ensure Git is all nice and clean ready for the next step.
Working on the Scratch Org
As I continue working, each thing I do in the org I use the command
sfdx force:source:pull
Which brings the metadata down to the source on my local machine.
Weird Things
The end goal for me would be to create a scratch org that I am happy using that has all my standard modifications in it (eg as shown in
Add Comment