Salesforce is constantly evolving, announcing products for end users, as well as tools for developers. Dreamforce’17 Salesforce introduced a major improvement in development lifecycle - Salesforce DX
What is it?
It's a modern developer experience that provides you with an integrated, end-to-end lifecycle designed for high-performance agile development.
The advantages for the developer
The traditional development approach always led to one, but very significant problem for supporting a large project, a stable version of the product is constantly needed. Since it is quite problematic to have a stable version when developing new functionality, developers had to use various tricks to solve this problem.
And here comes into play the Salesforce DX. With its help, you can create a full or partial copy of your product on a new org for each new functionality, develop it, test it, and then roll it on the main org.
Setting up the project:
First, you need to create a so-called Developer Hub Org. This is the main org with which you can manage your Scratch Orgs. Also if you need to use namespace prefixes in your Scratch Orgs, you need to bind them to Developer Hub Org.
Scratch org is directly your organization for development or testing.
Now that you have familiarized yourself with the basic concepts and registered the Developer Hub, you need to install the Command Line Interface, after which you can manage your orgs from the command line.
It should be noted that Salesforce DX uses the new metadata format. In fact, you have a more detailed breakdown of your objects. For example, when you add a new field ex Color__c to an account, you will no longer see in the version control system that the Account.object has changed, instead, a new Color__c.field-meta.xml file will be created in the objects\Account\fields folder. That allows you to better monitor changes on your project. CLI allows you to convert the old format to a new one or vice versa with the command force:source:convert.
Let's start creating Scratch org. With the force:project:create command, you create the skeleton of your organization. In which is the main configuration file config / project-scratch-def.json. In it you specify the settings of your organization and which functionality will be available in the org. Full list can be found here.
Then you can create an org and start developing your application or deploy your existing code to it with the force:source:push command.
Using the CLI, you can easily export and import data to your org for testing with the help of sfdx:force:data:tree:export / sfdx:force:data:tree:import. The CLI generates data in json and itself takes care of saving links between objects.
Salesforce DX is an excellent choice for projects that require ongoing development. Salesforce DX CLI allows easily and quickly creates organizations with full or partial copy of code and generation of test data. Having configured the project once, you will always have at hand a sandbox for your developments and a stable version for your customers.
For in-depth acquaintance with this functionality, you can use the training module developed by the Salesforce team.