Episode 0. Salesforce Deployment SFDX Know how!

Taken from google

Salesforce DX is put together a set of tools, features and APIs to make it easier for Salesforce teams to adopt modern DevOps. see it like a toolkit to strengthen better adoption of devops.

It encourages developers to adopt best practices for software development stacks, like using version control, and automating more parts of the release process, scripts etc.

Remember in itself DX may not necessarily perform all the devops processes as standalone but it brings on table all the blocks you need to connect with other elements — jenkins for scheduling or automation, github or bitbucket for source control,

SFDX comprises of set of tools —

  1. SF CLI :(push or pull metadata to & from orgs) , metadata ?: Database Schema; user interface; automation (workflows, process builders and flows),reports, code

2. Vs code: A new eclipse based IDE

3. Scratch orgs : to facilitae your tests, & mimic functioanlity (as an alternate to Dev sandbox) designed for your day to day development

4. 2nd gen Packaging : Club your functionalities & components together and make it ready to deploy, more on this later. (this is one of favorites: see this as individually deployable functionality rather than seeing your deployment as just package.xml built with chunks of metadata — too old concept) plus brings other benefits when we do market (regional)rollouts.

Ingredients (Tools) you need (1,2,3, 4 and you are set!) :

  1. Enable Dev hub (it is home to all your scratch orgs, central org, one place to manage your sc. orgs)— login to your Salesforce development or test environment and search for Dev hub in the setup & switch ON the plug

See how you would visualize this for developers

Way of working
Develop on Local source → Scratch Org →Source Control (e.g. github)→ Sandbox → production
1. Software developer works in local project repo , develops the functionality (code & config) and push to scratch org
2. In the Scratch or, it is tested & pulled back to local repo.
3. Next once tested, then finally the code goes to source Control repositry (this is the source of *TRUTH)

  • Person A: starts his /her work on user story A — 1. create a new feature branch from your source control (bitbucket / github), 2. create new scratch org and 3. pull your metadata to your local repo (GIT clone ) this gives you all you need as a starting point.

Thumb rule to remember is this process:

Push your local source and metadata to a scratch org.
Pull any changes you make in the scratch org back to your local project.
Sync this project with your source control repo.

Source:Taken from Google

Lets kickstart with a project (A →:F)

A. First Create a SFDX project

  1. Go to your commandline (window + R= keyboard shortcut) and run this command → sfdx force:project:create — projectname sfdx-Mo

Once project is created we need to:

B. Add our Salesforce DX project to our GIT source Control, for this :

+++++++ Move on to the GITHUB side & configure your GIT identity :

  • Create a GitHub repository at https://github.com/new, name it & next open cmd prompt type below

+++++++ Come back to your local project working repositry & Create a local git Repo, type this →

  • git init

++++++++ Commit Your Files to Git (version history) →
git add .
git commit — message “Initial commit of myproject metadata” (this commits the added files as a snapshot to the project’s version history)

++++++++ Push Your Files to GitHub →

C. Another Colleague starts in & joins the project, Here comes dev expert 2 Maria (see how she collaborate)

  1. She starts by cloning the parent (master) branch to its local repositry
    git clone https://github.com/EMEAMo../sfdx-project.git sfdx-maria

Conclusion: with this her code changes goes to her new respective feature branch, Next she needs to open pull request to merge changes into the master branch.

D. Familiarize yourself with the SFDX Commands:

  1. sfdx force:auth:web:login -d -a DevHub (to authorize against the Devhub)

E. Here are some of the powerful tasks that can be used directly through the command line:

  1. Export (SOQL) / Import (CSV) data

F. Tools available today for moving metadata (deployment)

  1. Change sets

Please Note: For few elements in the article, references are taken from online articles & docs, incase you find similarities , please dont be surprised :)

For more learning, please refer to trailheads- SFDX & GIT :


https://trailhead.salesforce.com/content/learn/modules/sfdx_app_dev/sfdx_app_dev_deploy && https://trailhead.salesforce.com/content/learn/projects/develop-app-with-salesforce-cli-and-source-control/set-up-your-environment?trail_id=move-to-a-continuous-integration-development &&


A useful utlity to see what DX supports and comparsion with others: https://mdcoverage.secure.force.com/docs/metadata-coverage/50

Thanks! Mc

Salesforce Program Architect at Salesforce