Salesforce DX Absolute Beginner ( Part 5 Of 7 )

In this fifth part of the salesforce DX series, I am going to show how to set up the Salesforce DX from the existing source base without creating the package.In this post, I am extracting the metadata from the salesforce into the eclipse project. We will use this project metadata to convert into the salesforce DX specific format.

1. Retrieve the Metadata

Create an eclipse project to extract the metadata from the salesforce.

 2. Login into Dev Hub from CLI 

Run the force:auth:web:login CLI command. If you are authorizing a Dev Hub org, use the –setdefaultdevhubusername parameter if you want the Dev Hub org to be the default for commands that accept the –targetdevhubusername parameter.

3. Create a DX Project

A Salesforce DX project has a specific structure and a configuration file that identifies the directory as a Salesforce DX project.Use the force:project:create command to create a skeleton project structure for your Salesforce DX project.

4. Export The Package.xml

Export the package.xml file into the temporary directory. Type the following commands in the root folder of your Salesforce DX project:

Unzip the unpackaged.zip file  which is created from the above command  and optionally delete the unpackaged.zip file

 5. Convert Source code to Salesforce  DX 

Convert the source code to the Salesforce DX project structure by running the following commands

6. Create a Scratch Org for Development

 You can create scratch org by Run the following commands.

7.Push Metadata into the scratch org
You can push the extracted metadata into the scratch org by running the below command into the scratch org.

8.Open scratch org

You can open scratch org by running following command.

9. 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.

10.Push Metadata into the scratch org
You can push the changes into the scratch org by running the below command.

Quick Recap of part 5 before going to part 6

  • Create an Eclipse Project to extract metadata from the salesforce
  • Convert package.xml file into Salesforce DX format.