sfdx: how to deploy the project to salesforce


Problem:

We in TrueSalesSoft do not like Apache Ant because we need to configure it using xml. It looks out of date. The question is how to deploy the Salesforce project without Apache Ant?

Solution:

We can use Metadata API with sfdx.

Step 1: You need to setup a connection

To see a list of existing connections you can use the following command:

sfdx force:org:list

To add a new connection you can use:

sfdx force:auth:web:login -r https://test.salesforce.com -a <your_alias>

Step 2: You can deploy the project

To deploy the project directory you can use the following command:

sfdx force:mdapi:deploy -d <directory> -u <username or alias>

You can use -c to run validation without deployment.

Step 3: Check the results

You can use <job_id> to check the results of the deployment process with the following command:

sfdx force:mdapi:deploy:report -u <your_alias> -i <job_id>

If you have any questions regard the problem above or anything else please send it in our contact form on TrueSalesSoft.com we will help you soon.