The title says it all if you have been developing before on IDE/ Mavenmate/IntelliJ and started using Salesforce DX. One that gets pretty tedious fast is manually pushing your code to your scratch org or deploying to your non-tracked org(DE/Sandbox).

To enable auto push/deploy simply edit the .vscode/settings.json. This folder can be hidden on Windows or Mac. On a Mac open the Finder and hit CMD+Shift dot(.) to display hidden files.

Add the following settings and set it to true.

"salesforcedx-vscode-core.push-or-deploy-on-save.enabled": true

My settings.json looks like below.

Another method to do this same steps is to go to the Code menu and choose Preferences then Settings.

Next click on Workspace tab then search for Salesforce

Under Salesforce Feature Previews(3rd one), tick the box under Salesforcedx-vscode-core › Push-or-deploy-on-save: Enabled

This is particularly useful specially for cloned repository where the .vscode folder is not part of the repository.

Don’t forget to update the .gitignore file if you are using version control and add the .vscode folder.

Happy coding!

One response to “Enable Auto Push or Auto Deploy With Salesforce DX on VSCode”

  1. […] Once done you can start modifying your code. Right click on a file to deploy it to the Source Org or enable the auto deploy on Save settings. […]

Leave a Reply

Your email address will not be published. Required fields are marked *