SFDX: Use VSCode + Scratch org

SFDX CLI is improving with each passing day. The number of developers using VScode as there default IDE is also increasing. If you don’t know how to setup SFDX cli, you can check my post. Today we will study how we can use VScode + Scratch Org for development in any org. ISV partner can use it to work on there apps and others can use it for in house development. Previously I have shared CLI script but using VS code the steps are very less.

If you haven’t install VScode yet, you should download that first. After that click on extensions tab and search for Salesforce Extension pack and install it. It will take 2-32 minutes, once its ready you can move to next steps.

Salesforce Extension Pack VScode SFDX

Then we need to Create a new project and fetch current code in that. For this you can find detail steps here.

Once you done that, Now we need to authorise our org Dev Hub Org. You can enable dev in any Developer/Production org. (Note: If you have namespace registered then you can’t enable Dev Hub in that org.)

Authorize a Dev Hub SFDX + VSCode

Once you have enabled the dev Hub org. We will create default scratch org. Keep Most configuration same, except number of days that can be increased/decreased.

Default Scratch Org SFDX Vscode

Once the default scratch org is created. We simply push the existing code into this org.

Push code to Default Scratch Org SFDX VSCode

Now We can open this org and can continue our development.

Open Default Org SFDX VScode

Once you done with development and Testing and are now ready to move code again to your main org. Simply change the default org and then select Deploy Source to org.

Change Default Org SFDX VScode
Deploy Source to Org SFDX VScode

So with just point and click we have setup SFDX: VSCode + Scratch Org and can do the development.

Do you have any question or wants to add anything, let me know in comments. Happy Programming 🙂


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.