Salesforce DX Absolute Beginner ( Part 4 Of 7 )
In this fourth part of the salesforce DX series, I am going to show how to set up the Salesforce DX from the existing source base by creating the temporary package. If you are already a Salesforce developer or ISV, you likely have the existing source in a managed package in your packaging org or some application source in your sandbox or production org. Before you begin using Salesforce DX, retrieve the existing source and convert it to the Salesforce DX project format.When you convert existing Metadata API source to Salesforce DX project format, we create an XML file for each bit. All files that contain XML markup now have an .xml extension. You can then look at your source files using an XML editor. To sync your local projects and scratch orgs, Salesforce DX projects use a particular directory structure for custom objects, custom object translations, Lightning components, and documents.
Unzip the unpackaged.zip file and optionally delete the unpackaged.zip file
6. Convert Source code to Salesforce DX
Convert the source code to the Salesforce DX project structure by running the following commands.
cd .. sfdx force:mdapi:convert -r ./temp
8.Push Metadata into the scratch org
You can push the extracted metadata into the scratch org by running the below command.
sfdx force:source:push
9: Open scratch org
You can open scratch org by running following command.
sfdx force:org:open
10. Pull Changes from Scratch Org, if any needed
sfdx force:source:pull
11. Implement the new features
Now if you wanted to make any changes you can do in the scratch org . In this example, you can create an apex class by running this command.
sfdx force:apex:class:create --classname DemoClass --template DefaultApexClass --outputdir force-app/main/default/classes/
push changes to scratch org again after development by running the following command.
Quick Recap of part 4 going to part 5
- Salesforce DX Project setup
- Converting metadata into DX specific format
- Making changes and push to scratch org