Chapter 6 : Deploy metadata from Scratch Org to Sandbox/Production Environment using SFDX

In this Chapter we will learn about how to Deploy metadata from Scratch Org to Sandbox/Production Environment using SFDX

Perquisites

Please go through Earlier Chapters in the Lightning Web Component Series before starting this one to get thorough understanding of the concepts.

Let’s get Started !

Scratch org does not have package.xml but will have it when we convert it into metadata format so that we can deploy it to sandbox/ production org.

Deploying metadata to a Salesforce instance

Much like existing tools such as the Force.com IDE and Migration Tool (ant), you’ll need a structured source directory (src) and a manifest file (package.xml) in order to deploy metadata.

Step 1: Convert source format to metadata format

Execute below command from the project

sfdx force:source:convert -d metadatadeploy

Converts metadata retrieved via Metadata API into the source format used in Salesforce DX projects.

-d Folder where metadata is generated

Step 2: Deploy from scratch to sandbox/ production org 

Execute below command

Sfdx: force:mdapi:deploy -d depmetadata -u sandboxtodeploy

-d Deployment folder where metadata is present

-u username of sandbox /prod org

When deploying, you can choose to wait until the deployment has completed (or until the specified number of minutes has expired)

sfdx force:mdapi:deploy -d metadatadeploy -w 5 -u sfdcSmriti

Step 3: Check deployment Status

Execute below command

sfdx force:mdapi:deploy:report

 

Together we can learn faster 

Join LWC study group on Telegram 

Subscribe to Youtube channel and blog to get latest updates

 

Reference

Lightning Web Component Superbadge

Convert and Deploy an exsisting app

Salesforce CLI

Convert SFDX source to MDAPI source

mdapi Commands

Did you enjoy this article?
Signup today and receive free updates straight in your inbox.
I agree to have my personal information transfered to MailChimp ( more information )
50% LikesVS
50% Dislikes