Salesforce DX – Salesforce Developer Experience

Salesforce Developer Experience which is the most Trending Topic in these days.

SFDX is a new tool to manage and develop apps on the force.com platform. It is created for developers to build apps on force.com together in a team.

It makes the developers experience easy so that developers can do coding with less effort in a short period of time and build apps together with version control system.

It also changed the way to deploy the application on force.com platform.

Some Import features of Salesforce DX

  • Scratch Org
  • Source Sync
  • Salesforce Command Line Interface(CLI)
  • Test Runner
  • Continuous Integration
  • Force IDE and Visual Studio with DX Support

Let’s start some work on SFDX tool

Download SFDX CLI and install in your System.

Enable DEV HUB in your org so you can create scratch orgs from CLI and use this tool easily or you can create a 30 days trail org in which DEV HUB is by default activated.

Open your Command window and authorize your org

sfdx force:auth:web:login

it will redirect to salesforce login page automatically and then enter your DEV HUB org username and password.

After login you will get something like this.

1st

Check your connected orgs.

sfdx force:org:list

2nd

I have worked on these three org that’s why it’s showing these three orgs list but you will get only one org DevHub if you are using it first time.

You can check the all available things which you can do using SFDX CLI and commands list with explanation by using below two commands

Sfdx force –help

Sfdx force:doc:commands:list

Let’s create a SFDX Project

sfdx force:project:create -n ProjectName

5th

Your Project contains these files and folders.

6th

sfdx-project.json is the project configuration file contains the sfdx project information and it also tell the sfdx where to put all components when you pull data from scratch org.

7th

project-scratch-def.json is the scratch org definition file indicates which type of scratch org will be created and some basic details for scratch org like orgName or edition of Scratch org.

You can manually edit this file like replace Developer edition to Enterprise if you want to create Enterprise Edition scratch org or any other edition.

8th

Force-app folder contains all components like apex class, custom objects, visualforce pages etc..

Create a Scratch Org

sfdx force:org:create -s -f config/project-scratch-def.json -a AliasName

-s indicates this scratch org would be the default scratch org for this project.

-f indicates the path of scratch org definition file

-a indicates the alias name for this scratch org

Alias Name will be helpful when you have multiple scratch orgs. You just need to put alias name for open scratch org instead of using the username of scratch org.

9th

Open Scratch org

sfdx force:org:open

This will open the default scratch org if you have otherwise you can use alias name to open other scratch org.

sfdx force:org:open –u AliasName

10th

Create a Apex class in your project

sfdx force:apex:class:create -n ApexclassName -d force-app/main/default/classes

-n indicates the Apex class Name

-d indicates the Path for Apex class in your project

11th

Open Apex class in your project and do some thing and push all changes to scratch org

12th

Push all changes to Scratch org

sfdx force:source:push

13th

Let’s review it in the scratch org

Login in to the scratch org by sfdx force:org:open using SFDX it will automatically open your scratch org or you can get list of orgs to know the details of all connected orgs and scratch orgs.

14th

Let’s do some change in the apex class from Scratch org and pull changes you your project.

This Is the way you can sync all changes with your project to scratch orgs.

sfdx force:source:pull

16th

15th

17th

You can refer some related blog posts or official site for more details-

https://audit9.blog/2017/08/06/salesforce-dx/

http://bobbuzzard.blogspot.in/2017/12/sfdx-and-metadata-api.html

https://www.salesforce.com/products/platform/products/salesforce-dx/

http://www.jitendrazaa.com/blog/tag/sfdx/

Hope you find this helpful, in case of any queries/concerns, please post a reply or drop an email to me at [email protected] .