Salesforce CLI for non-scratch orgs
This blog post takes a deep dive on how to use DX for all developer, Prod and Non-prod Salesforce environments other than scratch orgs.
Pre-requisites:
- Install VS Code
- Install Salesforce Extensions for VS Code
You can refer this post for a crisp introduction on Salesforce DX.
Now if everything is set-up, let’s get started. Create a project as shown below: Open VScode and press cmd+Shift+p, It will give some option. Select SFDX: Create Project.
Now open the command line in the vs code and create a project using the below command
sfdx force:project:create --projectname Sfdcbrewery
Lets set an alias for the org using the following command:
sfdx force:auth:web:login --setdefaultdevhubusername --setalias sfdcbrewery
Now lets create a Metadata file to pull the components we want to work with as shown below:
sfdx force:mdapi:retrieve -r metadata -u sfdcbrewery -k metadata/package.xml
- -u : Username or alias of the Salesforce Org
- -r : Location where zip file should be saved
- -k : List of components to be retrieved using package.xml
As we get a Zip file, lets unzip it using the below command:
unzip -o metadata/unpackaged.zip -d metadata
In similar way, you can deploy your metadata using the below command:
sfdx force:mdapi:deploy -c -d ../mdAPIZip/unpackaged -u sfdcbrewery -w 10
- -u : Which Salesforce Org to be used by Salesforce DX
- -f : Zip file location containing metadata and package.xml
- -c : Check only flag, Package would be validates only
- -w : Wait time in minute for operation to be completed
- -d : Folder location of non-zipped files, with package.xml in root
Resources:
Keywords: #SFDCBrewery #SriharideepKolagani #SalesforceDX #SalesforceDevelopment #Salesforce #SFDCBrewery #Brewery #SalesforceOnlineTraining #SalesforceTutorials #SalesforceCertification