SFDX Projects and Scratch Orgs

by | Nov 26, 2018 | SFDX | 6 comments

In my last post, I demonstrated how to authorise a dev hub and create an alias for it. Also, how to see a list of the orgs to which you are connected via CLI. In this post I am gonna demonstrate how to create an SFDX project and create a scratch org from it and also how to synchronise them both. I will also demonstrate how to push all these changes to Git (Git configuration is beyond the scope of this post but you can always google it). Lets get started!

How to create an SFDX Project:

Before we even explore how to create a project, we need to understand why do we need to create a project. I am sure you guys must have asked this to yourselves. The simple reason behind this is the package model approach. Isolating features into projects helps us release these changes as a package rather than overlapping with other changes and releasing as an org deployment. And also, because projects contain the configuration file which allows us to create scratch orgs. so lets see how to create a project. Using terminal you can fire the following command to create a project. Here,  -n stands for name of the project. A project can also be created using the SFDX extension for VS Code. It is rather easy. Checkout the video to see how.

How to create a Scratch Org from your SFDX Project:

As seen in the video above, when you create an SFDX project, it automatically creates config files with information about the scratch org. Tweak the values to create a scratch org of your liking. So, here is how you use the config file to create a scratch org. Using the terminal fire up the following command. What this above command does is, it creates a scratch org using the project definition file as mentioned with -f argument and alias TestOrg1 as mentioned with -a argument. We can also create a default scratch org using the SFDX VS Code extensions. Let’s see the video for that.

 

So this is how we create SFDX projects and create scratch orgs from them. Next I will show how to sync these changes with your repository. Until then adios, Happy New Year!

Bishwambhar Sen
Bishwambhar Sen is an IT professional with over 10 years of industry experience. He is a Salesforce certified developer and admin. When he is not configuring and customising, he loves photography, traveling and blogging.
Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

Share This