Mytutorialrack

Command Line Interface is a powerful software that really brings out the true power of the system. Salesforce CLI is popular among developers which makes tedious tasks feel quite easy. Today, we are going to explore some of the most useful sfdx commands. We will learn how you execute them and boost overall productivity. Let’s start with the journey.

How to Install Salesforce CLI?

Before moving on to the commands, let’s first install the Command line interface on your system. There is no rocket science in downloading the Salesforce CLI for any OS that you have. Whether it is Linux, Mac, or Windows, the line interface is ready to install. The steps for the same are

sfdx commands
  1. Go to Salesforce CLI website and download the package according to your operating system.
  2. Once the setup wizard is complete, you are ready to rock and roll

SFDX Commands

Once you have successfully installed the SFDX command line interface, its now time to go through some common commands. These commands are not only easy to apprehend but will also improve the way of coding.

Check SFDX Version

sfdx --version

Update SFDX

sfdx update

Logging In Dev Hub

sfdx auth:web:login -d -a DevHub 

Sandbox Login

sfdx auth:web:login -r https://MyDomainName--SandboxName.my.salesforce.com -a FullSandbox

Listing Authorize Orgs

sfdx auth:list

Open Org

sfdx force:org:open -u DevHub

Logging Out Orgs

sfdx auth:logout -u me@my.org

Create DX Project

sfdx force:project:create -n MyProject

Create DX Project with Manifest

sfdx force:project:create --projectname ProjectWithManifest --manifest

Get Code in Local Project

sfdx force:source:retrieve --manifest manifest/package.xml

Creating Scratch Org

sfdx force:org:create --setdefaultusername -f config/project-scratch-def.json --setalias MyScratchOrg -v DevHub

Open Scratch Org

sfdx force:org:open -u DevHubMyScratchOrg

Add Metadata to Scratch Org

sfdx force:source:push --targetusername MyScratchOrg

Get Metadata from Scratch Org

sfdx force:source:pull --targetusername MyScratchOrg

Get Password for Scratch Org

sfdx force:user:password:generate -u MyScratchOrg

Create Unlocked Package

sfdx force:package:create --name --description --packagetype Unlocked --path force-app --nonamespace --targetdevhubusername

Create Package Version

sfdx force:package:version:create -p -d force-app --wait 10 -v

Also Read: Operators in Apex

Conclusion

We hope that you are now familiar with some of the most commonly used SFDX Commands in Salesforce. Make sure to use them in your regular working environment as it will help you to remember them.

Share:

Recent Posts