SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
SFDX
Salesforce Developer eXperience
2018
Introduction
Bohdan Dovhan
Senior Salesforce Developer
Salesforce Development Team Lead
Salesforce Certified Platform Developer I
Salesforce Certified Platform Developer II
Salesforce Certified Platform App Builder
8 years of Development experience
5 years of Development on Salesforce platform
What is SFDX?
SFDX is both a new set of tools and new features affecting development lifecycle.
SFDX helps to shift source of truth from production org to VCS repository.
SFDX is an opportunity to shift the source of truth management and org
development lifecycle [1]
SFDX is most useful for team members using CLI or IDE
Development Styles
Org based development vs. source driven development.
In a traditional SF Dev Lifecycle, application builders use sandboxes to create and
test changes. Source of truth is either production or any sandbox containing
most recent version of code and customization.
With Salesforce DX, you might use source driven development using latest
versions from a centralized source control system like GIT or SVN.
SFDX concepts
SFDX CLI – command line interface tools, for executing commands like
> sfdx force:doc:commands:list
Unlocked packages are intended to provide a repeatable, scriptable and
trackable vehicle for introducing and managing change in your orgs.
Scratch Org is a temporary organization created from DevHub
DevHub feature can be enabled on production or tried in SFDX Trial Org [2]
Without scratch org
With scratch org
DevHub options
SFDX CLI is SF CLI
Using SFDX CLI you can use both DX features and standard features.
For example, you can run a SOQL query using CLI
> sfdx force:data:soql:query –q “select id, name from account limit 10” –u production
However, force:source:pull and force:source:push work only with scratch
orgs.
You can create a scratch org by force:org:create command only from DevHub
org – production or trial organization with DevHub feature turned on
Read Release Notes [3] !
They have added ability to write custom plugins if you know Node.js
Authentication
To authenticate into a non-scratch org execute command
> sfdx force:auth:web:login -a alias
This would open a new browser tab where you can login, OAuth credentials will be
stored on local machine.
Find list of custom object on org
> sfdx force:schema:sobject:list -c custom -u alias
Create a record
> sfdx force:data:record:create -s Account -v "Name=Test" –u alias
You can also run Apex tests, retrieve metadata, deploy metadata, create users,
assign permission set etc.
CLI uses Tooling API and Metadata API under hood
DX Project creation
To create a folder with SFDX project
> sfdx force:project:create -n MyNewProject
This would create MyNewProject subfolder in the current folder with SFDX project
structure.
Common files and folder of SFDX project include
sfdx-project.json – contains default project settings
config/project-scratch-def.json – controls shape of scratch org creation
.forceignore – controls source files to omit for push, pull and status commands [4]
force-app/main/default/ - contains source code and configuration metadata
Project settings file
Default content of project settings file sfdx-project.json contains [4]
{
"packageDirectories": [ //source element folder
{
"path": "force-app",
"default": true
}
],
"namespace": "", //possible configuration of namespace
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "42.0“ // default version of created classes, components etc.
}
Scratch org config
Default content of scratch org definition configuration file config/project-scratch-def.json
contains [6]
{
"orgName": "rwinkelmeyer Company",
"edition": "Developer",
"orgPreferences" : {
"enabled": ["S1DesktopEnabled"]
}
}
To create a scratch org with given settings
> sfdx force:org:create -f config/project-scratch-def.json -a MyScratchOrg.
Scratch org config
Disable Lightning session cache in scratch org
{
"orgName": "rwinkelmeyer Company",
"edition": "Developer",
"orgPreferences" : {
"enabled": ["S1DesktopEnabled"],
"disabled": ["S1EncryptedStoragePref2"]
}
}
To create a scratch org with given settings
> sfdx force:org:create -f config/project-scratch-def.json -a MyScratchOrg.
Global or local config
Find configuration setting by using command
> sfdx force:config:list
Set local setting by command
> sfdx force:config:set
Set global setting by command
> sfdx force:config:set -g
Global settings are stored in “.sfdx” folder under your user account, while local
settings are stored in “.sfdx” folder in the project root folder.
Global settings apply to all projects, local settings apply to project where they are
defined.
It is commonly suggested to add “.sfdx” folder to git ignore
Config list output
Output example of command sfdx force:config:list
=== Config
NAME VALUE LOCATION
───────────────────── ───────────── ────────
defaultdevhubusername DevHub Global
defaultusername GeoAppScratch Local
SFDX Source Control
Three commands to work with sources, similar to git commands
To push local source files to scratch org, use force:source:push command
To pull source files from scratch org to local folder, use force:source:pull
To determine source status, use force:source:status command
However, force:source:pull and force:source:push work only with scratch
orgs.
Once you run force:source:status command, it’ll detect which files have changed
(from a Salesforce DX perspective) since your last pull or push. This is
extremely helpful for detecting remotely changed files, especially when you
have changed the same file locally. The pull and push commands provide a —
forceoverwrite flag which you can then use to enforce (as the name says) an
overwrite for a changed file.
Development Cycle
1. Create a new scratch org and push existing code to it (or start with a new
project from scratch).
2. Develop live in the scratch org and test changes.
3. Pull the changes down to the local machine.
4. Change some components locally.
5. Push the components and validate the work in the org.
6. Commit the changes to git (never forget that scratch orgs expire, so make sure
your code is in version control).
CI with DX Config
1. Install Salesforce CLI on the CI host.
2. Obtain or create a digital certificate to secure your connection to the Salesforce
org. (self-signed certificates work OK)
3. Create and configure a Connected App in your Dev Hub org.
4. Authorize your Salesforce CI user to access this Connected App.
5. Configure a Salesforce JWT (JSON Web Tokens) authentication flow. This
allows the CI host to securely perform headless (without human interactivity)
operations on your Dev Hub org.
Trailhead module to try CI with DX using Travis [7]
CI with DX
What can or should be done with DX CI?
1. Create a fresh scratch org for test run
2. Run Apex Tests sfdx force:apex:test:run -w 10 -c -r human
3. Run Lightning Lint sfdx force:lightning:lint
./path/to/lightning/components/
4. Run Lightning Testing Service [8]
a) Install LTS: sfdx force:lightning:test:install
b) Run: sfdx force:lightning:test:run -a jasmineTests.app
5. Clean up test environment
CI with DX
What can or should be done with DX CI?
> sfdx force:lightning:lint force-app/main/default/aura —verbose —exit && /
> sfdx force:org:create -w 10 -s -f config/project-scratch-def.json -a ciorg && /
> sfdx force:source:push && /
> sfdx force:apex:test:run -c -r human -w 10
> sfdx force:org:delete -u ciorg -p
CD with DX
DX Continuous delivery options
1. Unlocked packages (second generation packages)
2. Managed packages
3. Metadata API
Create unlocked package version
Deprecated sfdx force:package2:version:create
Use: sfdx force:package:version:create
Update unlocked package version
Deprecated sfdx force:package2:version:update
Use: sfdx force:package:version:update
Install sfdx force:package:install
MP and Metadata API
Create managed package version
sfdx force:package1:version:create /
-i $packageId /
-n "v$releaseVersion" /
-v "$releaseVersion" /
--managedreleased
-w 10
Metadata API Deployment
mkdir mdapi_temp_dir
sfdx force:source:convert -d mdapi_temp_dir
sfdx force:mdapi:deploy -d mdapi_temp_dir/
-u $targetOrg -w 10
rm -fr mdapi_temp_dir
Data Tree Migration
Export data tree data
sfdx force:data:tree:export -q "SELECT Name, Location__Latitude__s,
Location__Longitude__s FROM Account WHERE Location__Latitude__s != NULL AND
Location__Longitude__s != NULL" -d ./data
Import data tree data
sfdx force:data:tree:import --plan data/sample-data-plan.json
SFDX allows to migrate both metadata and data
However, not too much of data, it is not complete replacement for
DataLoader [9]
Apex class creation
SFDX CLI has commands to create empty apex class, trigger, visualforce page,
component and lightning component.
sfdx force:apex:class:create -n DebugClass -d classes
sfdx force:apex:class:create -n CustomException -d classes -t ApexException
sfdx force:apex:class:create -n TestDebug -d classes -t ApexUnitTest
sfdx force:apex:class:create -n EmailService -d classes -t InboundEmailService
sfdx force:apex:trigger:create -n AccTrigger -s Account -e 'before insert, after update'
sfdx force:visualforce:page:create -n Page -l Label -d pages
sfdx force:visualforce:component:create -n comp -l compLabel -d components
sfdx force:lightning:app:create create a Lightning app
sfdx force:lightning:component:create create a Lightning component
sfdx force:lightning:event:create create a Lightning event
sfdx force:lightning:interface:create create a Lightning interface
sfdx force:lightning:test:create create a Lightning test
Files creation
SFDX CLI has commands to create empty apex class, trigger, visualforce page,
component and lightning component.
sfdx force:apex:class:create -n DebugClass -d classes
sfdx force:apex:class:create -n CustomException -d classes -t ApexException
sfdx force:apex:class:create -n TestDebug -d classes -t ApexUnitTest
sfdx force:apex:class:create -n EmailService -d classes -t InboundEmailService
sfdx force:apex:trigger:create -n AccTrigger -s Account -e 'before insert, after update'
sfdx force:visualforce:page:create -n Page -l Label -d pages
sfdx force:visualforce:component:create -n comp -l compLabel -d components
sfdx force:lightning:app:create create a Lightning app
sfdx force:lightning:component:create create a Lightning component
sfdx force:lightning:event:create create a Lightning event
sfdx force:lightning:interface:create create a Lightning interface
sfdx force:lightning:test:create create a Lightning test
Pecularities
SFDX CLI has commands to create empty apex class, trigger, visualforce page,
component and lightning component.
However, all other components like SObjects, Fields, Tabs should be created
manually and then pulled from scratch organization
Each custom object field is a separate file. Each element in zipped static resource
is a separate file.
No destructiveChanges.xml is needed, just delete the source file, push and it will
be deleted from scratch organization
Limits
How many activetotal scratch orgs can I have in my edition?
EE – 40, UE, PerfE – 100, Trial – 20 active scratch orgs.
EE – 80, UE, PerfE – 200, Trial – 40 daily scratch orgs allocations.
Edition Active Scratch
Org Allocation
Daily Scratch
Org Allocation
Enterprise
Edition
40 80
Unlimited
Edition
100 200
Performance
Edition
100 200
Dev Hub trial 20 40
Limits
How many active scratch orgs do I
currently have?
Execute command
sfdx force:limits:api:display
-u DevHub
Source conversion
How do I convert my existing source to DX?
First, you need to create a project
sfdx force:project:create -n super_awesome_dx_project
Place a folder with old source in project folder, then execute commands
sfdx force:mdapi:convert -r mdapipackage/
I have a DX project but I want to use ANT Migration Tool. How do I convert DX project
back to ANT migration Tool format?
Easy. Just execute commands
mkdir mdapioutput
sfdx force:source:convert -d mdapioutput/
ANT Tasks in DX
Can I deploy ant project with DX?
Yes. Definitely, just run a command
sfdx force:mdapi:deploy -d mdapioutput/ -w 100
You might want to specify alias for target deployment organization with -u flag.
How do I perform ANT Retrieve task with DX?
Retrieve package
sfdx force:mdapi:retrieve -s -r ./mdapipackage -p DreamInvest -u org -w 10
Retrieve unpackaged source
sfdx force:mdapi:retrieve -k package.xml -r testRetrieve -u org
Licenses support DX
After you’ve enabled Dev Hub capabilities in an org, you’ll need to create user
records for any members of your team who you want to allow to use the Dev
Hub functionality, if they aren’t already Salesforce users. Three types of
licenses work for Salesforce DX users:
•
Salesforce,
•
Salesforce Platform
•
and the new Salesforce Limited Access license.
Permissions needed
To give full access to the Dev Hub org, the permission set must contain these
permissions.
•
Object Settings > Scratch Org Info > Read, Create, and Delete
•
Object Settings > Active Scratch Org > Read and Delete
•
Object Settings > Namespace Registry > Read, Create, and Delete
To work with second-generation packages in the Dev Hub org, the permission set
must also contain:
•
System Permissions > Create and Update Second-Generation Packages
References1. https://developer.salesforce.com/blogs/2018/02/getting-started-salesforce-dx-part-1-
5.html
2. https://developer.salesforce.com/promotions/orgs/dx-signup
3. https://developer.salesforce.com/media/salesforce-cli/releasenotes.htm
4. https://developer.salesforce.com/docs/atlas.en-
us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm
5. https://developer.salesforce.com/docs/atlas.en-
us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm
6. https://developer.salesforce.com/docs/atlas.en-
us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_def_file_config_values.htm
7. https://trailhead.salesforce.com/modules/sfdx_travis_ci
8. https://github.com/forcedotcom/LightningTestingService
9. https://salesforce.stackexchange.com/questions/221991/sfdx-datasoqlquery-fails-
on-significant-amount-of-data
10. https://developer.salesforce.com/docs/atlas.en-
us.sfdx_setup.meta/sfdx_setup/sfdx_setup_add_users.htm

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction to lightning Web Component
Introduction to lightning Web ComponentIntroduction to lightning Web Component
Introduction to lightning Web ComponentMohith Shrivastava
 
Introduction to External Objects and the OData Connector
Introduction to External Objects and the OData ConnectorIntroduction to External Objects and the OData Connector
Introduction to External Objects and the OData ConnectorSalesforce Developers
 
Salesforce DevOps using GitHub Action
Salesforce DevOps using GitHub ActionSalesforce DevOps using GitHub Action
Salesforce DevOps using GitHub ActionSakthivel Madesh
 
Salesforce Integration Patterns
Salesforce Integration PatternsSalesforce Integration Patterns
Salesforce Integration Patternsusolutions
 
First Steps to Salesforce Release Management & DevOps [Salesforce User Group,...
First Steps to Salesforce Release Management & DevOps [Salesforce User Group,...First Steps to Salesforce Release Management & DevOps [Salesforce User Group,...
First Steps to Salesforce Release Management & DevOps [Salesforce User Group,...Anna Loughnan Colquhoun
 
はじめようLightningコンポーネント
はじめようLightningコンポーネントはじめようLightningコンポーネント
はじめようLightningコンポーネントSalesforce Developers Japan
 
Manage Salesforce Like a Pro with Governance
Manage Salesforce Like a Pro with GovernanceManage Salesforce Like a Pro with Governance
Manage Salesforce Like a Pro with GovernanceSalesforce Admins
 
Salesforce Spring 23 Webinar
Salesforce Spring 23 WebinarSalesforce Spring 23 Webinar
Salesforce Spring 23 Webinarbrightgenss
 
Intro to Salesforce Lightning Web Components (LWC)
Intro to Salesforce Lightning Web Components (LWC)Intro to Salesforce Lightning Web Components (LWC)
Intro to Salesforce Lightning Web Components (LWC)Roy Gilad
 
Git/Github & Salesforce
Git/Github & Salesforce Git/Github & Salesforce
Git/Github & Salesforce Gordon Bockus
 
From Sandbox To Production: An Introduction to Salesforce Release Management
From Sandbox To Production: An Introduction to Salesforce Release ManagementFrom Sandbox To Production: An Introduction to Salesforce Release Management
From Sandbox To Production: An Introduction to Salesforce Release ManagementSalesforce Developers
 
Salesforce DevOps: Where Do You Start?
Salesforce DevOps: Where Do You Start?Salesforce DevOps: Where Do You Start?
Salesforce DevOps: Where Do You Start?Chandler Anderson
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceMaximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceSalesforce Developers
 
Lightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionLightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionSalesforce Developers
 
Force.com (Salesforce.com)
Force.com (Salesforce.com)Force.com (Salesforce.com)
Force.com (Salesforce.com)Vijay Maurya
 
Planning Your Migration to the Lightning Experience
Planning Your Migration to the Lightning ExperiencePlanning Your Migration to the Lightning Experience
Planning Your Migration to the Lightning ExperienceShell Black
 
Successfully creating unlocked package
Successfully creating unlocked packageSuccessfully creating unlocked package
Successfully creating unlocked packageMohith Shrivastava
 
Lwc presentation
Lwc presentationLwc presentation
Lwc presentationNithesh N
 
Salesforce Org Health Check & Performance Testing
Salesforce Org Health Check & Performance TestingSalesforce Org Health Check & Performance Testing
Salesforce Org Health Check & Performance TestingImtiazBinMohiuddin
 

Was ist angesagt? (20)

Introduction to lightning Web Component
Introduction to lightning Web ComponentIntroduction to lightning Web Component
Introduction to lightning Web Component
 
Architecting Multi-Org Solutions
Architecting Multi-Org SolutionsArchitecting Multi-Org Solutions
Architecting Multi-Org Solutions
 
Introduction to External Objects and the OData Connector
Introduction to External Objects and the OData ConnectorIntroduction to External Objects and the OData Connector
Introduction to External Objects and the OData Connector
 
Salesforce DevOps using GitHub Action
Salesforce DevOps using GitHub ActionSalesforce DevOps using GitHub Action
Salesforce DevOps using GitHub Action
 
Salesforce Integration Patterns
Salesforce Integration PatternsSalesforce Integration Patterns
Salesforce Integration Patterns
 
First Steps to Salesforce Release Management & DevOps [Salesforce User Group,...
First Steps to Salesforce Release Management & DevOps [Salesforce User Group,...First Steps to Salesforce Release Management & DevOps [Salesforce User Group,...
First Steps to Salesforce Release Management & DevOps [Salesforce User Group,...
 
はじめようLightningコンポーネント
はじめようLightningコンポーネントはじめようLightningコンポーネント
はじめようLightningコンポーネント
 
Manage Salesforce Like a Pro with Governance
Manage Salesforce Like a Pro with GovernanceManage Salesforce Like a Pro with Governance
Manage Salesforce Like a Pro with Governance
 
Salesforce Spring 23 Webinar
Salesforce Spring 23 WebinarSalesforce Spring 23 Webinar
Salesforce Spring 23 Webinar
 
Intro to Salesforce Lightning Web Components (LWC)
Intro to Salesforce Lightning Web Components (LWC)Intro to Salesforce Lightning Web Components (LWC)
Intro to Salesforce Lightning Web Components (LWC)
 
Git/Github & Salesforce
Git/Github & Salesforce Git/Github & Salesforce
Git/Github & Salesforce
 
From Sandbox To Production: An Introduction to Salesforce Release Management
From Sandbox To Production: An Introduction to Salesforce Release ManagementFrom Sandbox To Production: An Introduction to Salesforce Release Management
From Sandbox To Production: An Introduction to Salesforce Release Management
 
Salesforce DevOps: Where Do You Start?
Salesforce DevOps: Where Do You Start?Salesforce DevOps: Where Do You Start?
Salesforce DevOps: Where Do You Start?
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceMaximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component Performance
 
Lightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionLightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An Introduction
 
Force.com (Salesforce.com)
Force.com (Salesforce.com)Force.com (Salesforce.com)
Force.com (Salesforce.com)
 
Planning Your Migration to the Lightning Experience
Planning Your Migration to the Lightning ExperiencePlanning Your Migration to the Lightning Experience
Planning Your Migration to the Lightning Experience
 
Successfully creating unlocked package
Successfully creating unlocked packageSuccessfully creating unlocked package
Successfully creating unlocked package
 
Lwc presentation
Lwc presentationLwc presentation
Lwc presentation
 
Salesforce Org Health Check & Performance Testing
Salesforce Org Health Check & Performance TestingSalesforce Org Health Check & Performance Testing
Salesforce Org Health Check & Performance Testing
 

Ähnlich wie SFDX Presentation

Salesforce Developer eXperience (SFDX)
Salesforce Developer eXperience (SFDX)Salesforce Developer eXperience (SFDX)
Salesforce Developer eXperience (SFDX)Bohdan Dovhań
 
SFDX - Spring 2019 Update
SFDX - Spring 2019 UpdateSFDX - Spring 2019 Update
SFDX - Spring 2019 UpdateBohdan Dovhań
 
Comment utiliser Visual Studio Code pour travailler avec une scratch Org
Comment utiliser Visual Studio Code pour travailler avec une scratch OrgComment utiliser Visual Studio Code pour travailler avec une scratch Org
Comment utiliser Visual Studio Code pour travailler avec une scratch OrgThierry TROUIN ☁
 
Créer et gérer une scratch org avec Visual Studio Code
Créer et gérer une scratch org avec Visual Studio CodeCréer et gérer une scratch org avec Visual Studio Code
Créer et gérer une scratch org avec Visual Studio CodeThierry TROUIN ☁
 
sfdx continuous Integration with Jenkins on aws (Part II)
sfdx continuous Integration with Jenkins on aws (Part II)sfdx continuous Integration with Jenkins on aws (Part II)
sfdx continuous Integration with Jenkins on aws (Part II)Jérémy Vial
 
Salesforce Apex Hours:- Salesforce DX
Salesforce Apex Hours:- Salesforce DXSalesforce Apex Hours:- Salesforce DX
Salesforce Apex Hours:- Salesforce DXAmit Chaudhary
 
Get started with Salesforce DX
Get started with Salesforce DXGet started with Salesforce DX
Get started with Salesforce DXAnurag Bhardwaj
 
Easy Salesforce CI/CD with Open Source Only - Dreamforce 23
Easy Salesforce CI/CD with Open Source Only - Dreamforce 23Easy Salesforce CI/CD with Open Source Only - Dreamforce 23
Easy Salesforce CI/CD with Open Source Only - Dreamforce 23NicolasVuillamy1
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushPantheon
 
NAD19 - Create an org with Salesforce DX without Code
NAD19 - Create an org with Salesforce DX without CodeNAD19 - Create an org with Salesforce DX without Code
NAD19 - Create an org with Salesforce DX without CodeThierry TROUIN ☁
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Fabrice Bernhard
 
Operator SDK for K8s using Go
Operator SDK for K8s using GoOperator SDK for K8s using Go
Operator SDK for K8s using GoCloudOps2005
 
Build and Distributing SDK Add-Ons
Build and Distributing SDK Add-OnsBuild and Distributing SDK Add-Ons
Build and Distributing SDK Add-OnsDave Smith
 

Ähnlich wie SFDX Presentation (20)

Salesforce Developer eXperience (SFDX)
Salesforce Developer eXperience (SFDX)Salesforce Developer eXperience (SFDX)
Salesforce Developer eXperience (SFDX)
 
SFDX - Spring 2019 Update
SFDX - Spring 2019 UpdateSFDX - Spring 2019 Update
SFDX - Spring 2019 Update
 
Comment utiliser Visual Studio Code pour travailler avec une scratch Org
Comment utiliser Visual Studio Code pour travailler avec une scratch OrgComment utiliser Visual Studio Code pour travailler avec une scratch Org
Comment utiliser Visual Studio Code pour travailler avec une scratch Org
 
Créer et gérer une scratch org avec Visual Studio Code
Créer et gérer une scratch org avec Visual Studio CodeCréer et gérer une scratch org avec Visual Studio Code
Créer et gérer une scratch org avec Visual Studio Code
 
Salesforce DX for admin
Salesforce DX for adminSalesforce DX for admin
Salesforce DX for admin
 
Salesforce DX (Meetup du 11/10/2017)
Salesforce DX (Meetup du 11/10/2017)Salesforce DX (Meetup du 11/10/2017)
Salesforce DX (Meetup du 11/10/2017)
 
Sfdx introduction
Sfdx introductionSfdx introduction
Sfdx introduction
 
Salesforce DX for Admin v2
Salesforce DX for Admin v2Salesforce DX for Admin v2
Salesforce DX for Admin v2
 
sfdx continuous Integration with Jenkins on aws (Part II)
sfdx continuous Integration with Jenkins on aws (Part II)sfdx continuous Integration with Jenkins on aws (Part II)
sfdx continuous Integration with Jenkins on aws (Part II)
 
Salesforce Apex Hours:- Salesforce DX
Salesforce Apex Hours:- Salesforce DXSalesforce Apex Hours:- Salesforce DX
Salesforce Apex Hours:- Salesforce DX
 
Get started with Salesforce DX
Get started with Salesforce DXGet started with Salesforce DX
Get started with Salesforce DX
 
Easy Salesforce CI/CD with Open Source Only - Dreamforce 23
Easy Salesforce CI/CD with Open Source Only - Dreamforce 23Easy Salesforce CI/CD with Open Source Only - Dreamforce 23
Easy Salesforce CI/CD with Open Source Only - Dreamforce 23
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
 
NAD19 - Create an org with Salesforce DX without Code
NAD19 - Create an org with Salesforce DX without CodeNAD19 - Create an org with Salesforce DX without Code
NAD19 - Create an org with Salesforce DX without Code
 
Excelian hyperledger walkthrough-feb17
Excelian hyperledger walkthrough-feb17Excelian hyperledger walkthrough-feb17
Excelian hyperledger walkthrough-feb17
 
GradleFX
GradleFXGradleFX
GradleFX
 
Salesforce CLI
Salesforce CLISalesforce CLI
Salesforce CLI
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Operator SDK for K8s using Go
Operator SDK for K8s using GoOperator SDK for K8s using Go
Operator SDK for K8s using Go
 
Build and Distributing SDK Add-Ons
Build and Distributing SDK Add-OnsBuild and Distributing SDK Add-Ons
Build and Distributing SDK Add-Ons
 

Mehr von Bohdan Dovhań

PUBLISHING YOUR PACKAGE TO APPEXCHANGE IN 2023
PUBLISHING YOUR PACKAGE TO APPEXCHANGEIN 2023PUBLISHING YOUR PACKAGE TO APPEXCHANGEIN 2023
PUBLISHING YOUR PACKAGE TO APPEXCHANGE IN 2023Bohdan Dovhań
 
Second-generation managed packages
Second-generation managed packagesSecond-generation managed packages
Second-generation managed packagesBohdan Dovhań
 
Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance Bohdan Dovhań
 
Custom Metadata Records Deployment From Apex Code
Custom Metadata Records Deployment From Apex CodeCustom Metadata Records Deployment From Apex Code
Custom Metadata Records Deployment From Apex CodeBohdan Dovhań
 
Sdfc forbidden and advanced techniques
Sdfc forbidden and advanced techniquesSdfc forbidden and advanced techniques
Sdfc forbidden and advanced techniquesBohdan Dovhań
 
Being A Salesforce Jedi
Being A Salesforce JediBeing A Salesforce Jedi
Being A Salesforce JediBohdan Dovhań
 
Salesforce certifications process
Salesforce certifications processSalesforce certifications process
Salesforce certifications processBohdan Dovhań
 
Salesforce for marketing
Salesforce for marketingSalesforce for marketing
Salesforce for marketingBohdan Dovhań
 
Introduction about development, programs, saas and salesforce
Introduction about development, programs, saas and salesforceIntroduction about development, programs, saas and salesforce
Introduction about development, programs, saas and salesforceBohdan Dovhań
 

Mehr von Bohdan Dovhań (12)

PUBLISHING YOUR PACKAGE TO APPEXCHANGE IN 2023
PUBLISHING YOUR PACKAGE TO APPEXCHANGEIN 2023PUBLISHING YOUR PACKAGE TO APPEXCHANGEIN 2023
PUBLISHING YOUR PACKAGE TO APPEXCHANGE IN 2023
 
Second-generation managed packages
Second-generation managed packagesSecond-generation managed packages
Second-generation managed packages
 
Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance
 
Custom Metadata Records Deployment From Apex Code
Custom Metadata Records Deployment From Apex CodeCustom Metadata Records Deployment From Apex Code
Custom Metadata Records Deployment From Apex Code
 
Sdfc forbidden and advanced techniques
Sdfc forbidden and advanced techniquesSdfc forbidden and advanced techniques
Sdfc forbidden and advanced techniques
 
SFDC REST API
SFDC REST APISFDC REST API
SFDC REST API
 
Being A Salesforce Jedi
Being A Salesforce JediBeing A Salesforce Jedi
Being A Salesforce Jedi
 
Salesforce REST API
Salesforce  REST API Salesforce  REST API
Salesforce REST API
 
Salesforce certifications process
Salesforce certifications processSalesforce certifications process
Salesforce certifications process
 
Salesforce for marketing
Salesforce for marketingSalesforce for marketing
Salesforce for marketing
 
Introduction about development, programs, saas and salesforce
Introduction about development, programs, saas and salesforceIntroduction about development, programs, saas and salesforce
Introduction about development, programs, saas and salesforce
 
ExtJS Sencha Touch
ExtJS Sencha TouchExtJS Sencha Touch
ExtJS Sencha Touch
 

Kürzlich hochgeladen

Watermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesWatermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesShyamsundar Das
 
OpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorOpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorShane Coughlan
 
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine HarmonyLeveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmonyelliciumsolutionspun
 
Growing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesGrowing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesSoftwareMill
 
Top Software Development Trends in 2024
Top Software Development Trends in  2024Top Software Development Trends in  2024
Top Software Development Trends in 2024Mind IT Systems
 
Enterprise Document Management System - Qualityze Inc
Enterprise Document Management System - Qualityze IncEnterprise Document Management System - Qualityze Inc
Enterprise Document Management System - Qualityze Incrobinwilliams8624
 
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Jaydeep Chhasatia
 
Sales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales CoverageSales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales CoverageDista
 
Why Choose Brain Inventory For Ecommerce Development.pdf
Why Choose Brain Inventory For Ecommerce Development.pdfWhy Choose Brain Inventory For Ecommerce Development.pdf
Why Choose Brain Inventory For Ecommerce Development.pdfBrain Inventory
 
Streamlining Your Application Builds with Cloud Native Buildpacks
Streamlining Your Application Builds  with Cloud Native BuildpacksStreamlining Your Application Builds  with Cloud Native Buildpacks
Streamlining Your Application Builds with Cloud Native BuildpacksVish Abrams
 
online pdf editor software solutions.pdf
online pdf editor software solutions.pdfonline pdf editor software solutions.pdf
online pdf editor software solutions.pdfMeon Technology
 
How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?AmeliaSmith90
 
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/MLBig Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/MLAlluxio, Inc.
 
Webinar_050417_LeClair12345666777889.ppt
Webinar_050417_LeClair12345666777889.pptWebinar_050417_LeClair12345666777889.ppt
Webinar_050417_LeClair12345666777889.pptkinjal48
 
Deep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampDeep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampVICTOR MAESTRE RAMIREZ
 
Fields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxFields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxJoão Esperancinha
 
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...OnePlan Solutions
 
JS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIJS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIIvo Andreev
 
AI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human BeautyAI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human BeautyRaymond Okyere-Forson
 

Kürzlich hochgeladen (20)

Watermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesWatermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security Challenges
 
OpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorOpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS Calculator
 
Salesforce AI Associate Certification.pptx
Salesforce AI Associate Certification.pptxSalesforce AI Associate Certification.pptx
Salesforce AI Associate Certification.pptx
 
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine HarmonyLeveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
 
Growing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesGrowing Oxen: channel operators and retries
Growing Oxen: channel operators and retries
 
Top Software Development Trends in 2024
Top Software Development Trends in  2024Top Software Development Trends in  2024
Top Software Development Trends in 2024
 
Enterprise Document Management System - Qualityze Inc
Enterprise Document Management System - Qualityze IncEnterprise Document Management System - Qualityze Inc
Enterprise Document Management System - Qualityze Inc
 
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
 
Sales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales CoverageSales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales Coverage
 
Why Choose Brain Inventory For Ecommerce Development.pdf
Why Choose Brain Inventory For Ecommerce Development.pdfWhy Choose Brain Inventory For Ecommerce Development.pdf
Why Choose Brain Inventory For Ecommerce Development.pdf
 
Streamlining Your Application Builds with Cloud Native Buildpacks
Streamlining Your Application Builds  with Cloud Native BuildpacksStreamlining Your Application Builds  with Cloud Native Buildpacks
Streamlining Your Application Builds with Cloud Native Buildpacks
 
online pdf editor software solutions.pdf
online pdf editor software solutions.pdfonline pdf editor software solutions.pdf
online pdf editor software solutions.pdf
 
How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?
 
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/MLBig Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
 
Webinar_050417_LeClair12345666777889.ppt
Webinar_050417_LeClair12345666777889.pptWebinar_050417_LeClair12345666777889.ppt
Webinar_050417_LeClair12345666777889.ppt
 
Deep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampDeep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - Datacamp
 
Fields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxFields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptx
 
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
 
JS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIJS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AI
 
AI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human BeautyAI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human Beauty
 

SFDX Presentation

  • 2. Introduction Bohdan Dovhan Senior Salesforce Developer Salesforce Development Team Lead Salesforce Certified Platform Developer I Salesforce Certified Platform Developer II Salesforce Certified Platform App Builder 8 years of Development experience 5 years of Development on Salesforce platform
  • 3. What is SFDX? SFDX is both a new set of tools and new features affecting development lifecycle. SFDX helps to shift source of truth from production org to VCS repository. SFDX is an opportunity to shift the source of truth management and org development lifecycle [1] SFDX is most useful for team members using CLI or IDE
  • 4. Development Styles Org based development vs. source driven development. In a traditional SF Dev Lifecycle, application builders use sandboxes to create and test changes. Source of truth is either production or any sandbox containing most recent version of code and customization. With Salesforce DX, you might use source driven development using latest versions from a centralized source control system like GIT or SVN.
  • 5. SFDX concepts SFDX CLI – command line interface tools, for executing commands like > sfdx force:doc:commands:list Unlocked packages are intended to provide a repeatable, scriptable and trackable vehicle for introducing and managing change in your orgs. Scratch Org is a temporary organization created from DevHub DevHub feature can be enabled on production or tried in SFDX Trial Org [2]
  • 9. SFDX CLI is SF CLI Using SFDX CLI you can use both DX features and standard features. For example, you can run a SOQL query using CLI > sfdx force:data:soql:query –q “select id, name from account limit 10” –u production However, force:source:pull and force:source:push work only with scratch orgs. You can create a scratch org by force:org:create command only from DevHub org – production or trial organization with DevHub feature turned on Read Release Notes [3] ! They have added ability to write custom plugins if you know Node.js
  • 10. Authentication To authenticate into a non-scratch org execute command > sfdx force:auth:web:login -a alias This would open a new browser tab where you can login, OAuth credentials will be stored on local machine. Find list of custom object on org > sfdx force:schema:sobject:list -c custom -u alias Create a record > sfdx force:data:record:create -s Account -v "Name=Test" –u alias You can also run Apex tests, retrieve metadata, deploy metadata, create users, assign permission set etc. CLI uses Tooling API and Metadata API under hood
  • 11. DX Project creation To create a folder with SFDX project > sfdx force:project:create -n MyNewProject This would create MyNewProject subfolder in the current folder with SFDX project structure. Common files and folder of SFDX project include sfdx-project.json – contains default project settings config/project-scratch-def.json – controls shape of scratch org creation .forceignore – controls source files to omit for push, pull and status commands [4] force-app/main/default/ - contains source code and configuration metadata
  • 12. Project settings file Default content of project settings file sfdx-project.json contains [4] { "packageDirectories": [ //source element folder { "path": "force-app", "default": true } ], "namespace": "", //possible configuration of namespace "sfdcLoginUrl": "https://login.salesforce.com", "sourceApiVersion": "42.0“ // default version of created classes, components etc. }
  • 13. Scratch org config Default content of scratch org definition configuration file config/project-scratch-def.json contains [6] { "orgName": "rwinkelmeyer Company", "edition": "Developer", "orgPreferences" : { "enabled": ["S1DesktopEnabled"] } } To create a scratch org with given settings > sfdx force:org:create -f config/project-scratch-def.json -a MyScratchOrg.
  • 14. Scratch org config Disable Lightning session cache in scratch org { "orgName": "rwinkelmeyer Company", "edition": "Developer", "orgPreferences" : { "enabled": ["S1DesktopEnabled"], "disabled": ["S1EncryptedStoragePref2"] } } To create a scratch org with given settings > sfdx force:org:create -f config/project-scratch-def.json -a MyScratchOrg.
  • 15. Global or local config Find configuration setting by using command > sfdx force:config:list Set local setting by command > sfdx force:config:set Set global setting by command > sfdx force:config:set -g Global settings are stored in “.sfdx” folder under your user account, while local settings are stored in “.sfdx” folder in the project root folder. Global settings apply to all projects, local settings apply to project where they are defined. It is commonly suggested to add “.sfdx” folder to git ignore
  • 16. Config list output Output example of command sfdx force:config:list === Config NAME VALUE LOCATION ───────────────────── ───────────── ──────── defaultdevhubusername DevHub Global defaultusername GeoAppScratch Local
  • 17. SFDX Source Control Three commands to work with sources, similar to git commands To push local source files to scratch org, use force:source:push command To pull source files from scratch org to local folder, use force:source:pull To determine source status, use force:source:status command However, force:source:pull and force:source:push work only with scratch orgs. Once you run force:source:status command, it’ll detect which files have changed (from a Salesforce DX perspective) since your last pull or push. This is extremely helpful for detecting remotely changed files, especially when you have changed the same file locally. The pull and push commands provide a — forceoverwrite flag which you can then use to enforce (as the name says) an overwrite for a changed file.
  • 18. Development Cycle 1. Create a new scratch org and push existing code to it (or start with a new project from scratch). 2. Develop live in the scratch org and test changes. 3. Pull the changes down to the local machine. 4. Change some components locally. 5. Push the components and validate the work in the org. 6. Commit the changes to git (never forget that scratch orgs expire, so make sure your code is in version control).
  • 19. CI with DX Config 1. Install Salesforce CLI on the CI host. 2. Obtain or create a digital certificate to secure your connection to the Salesforce org. (self-signed certificates work OK) 3. Create and configure a Connected App in your Dev Hub org. 4. Authorize your Salesforce CI user to access this Connected App. 5. Configure a Salesforce JWT (JSON Web Tokens) authentication flow. This allows the CI host to securely perform headless (without human interactivity) operations on your Dev Hub org. Trailhead module to try CI with DX using Travis [7]
  • 20. CI with DX What can or should be done with DX CI? 1. Create a fresh scratch org for test run 2. Run Apex Tests sfdx force:apex:test:run -w 10 -c -r human 3. Run Lightning Lint sfdx force:lightning:lint ./path/to/lightning/components/ 4. Run Lightning Testing Service [8] a) Install LTS: sfdx force:lightning:test:install b) Run: sfdx force:lightning:test:run -a jasmineTests.app 5. Clean up test environment
  • 21. CI with DX What can or should be done with DX CI? > sfdx force:lightning:lint force-app/main/default/aura —verbose —exit && / > sfdx force:org:create -w 10 -s -f config/project-scratch-def.json -a ciorg && / > sfdx force:source:push && / > sfdx force:apex:test:run -c -r human -w 10 > sfdx force:org:delete -u ciorg -p
  • 22. CD with DX DX Continuous delivery options 1. Unlocked packages (second generation packages) 2. Managed packages 3. Metadata API Create unlocked package version Deprecated sfdx force:package2:version:create Use: sfdx force:package:version:create Update unlocked package version Deprecated sfdx force:package2:version:update Use: sfdx force:package:version:update Install sfdx force:package:install
  • 23. MP and Metadata API Create managed package version sfdx force:package1:version:create / -i $packageId / -n "v$releaseVersion" / -v "$releaseVersion" / --managedreleased -w 10 Metadata API Deployment mkdir mdapi_temp_dir sfdx force:source:convert -d mdapi_temp_dir sfdx force:mdapi:deploy -d mdapi_temp_dir/ -u $targetOrg -w 10 rm -fr mdapi_temp_dir
  • 24. Data Tree Migration Export data tree data sfdx force:data:tree:export -q "SELECT Name, Location__Latitude__s, Location__Longitude__s FROM Account WHERE Location__Latitude__s != NULL AND Location__Longitude__s != NULL" -d ./data Import data tree data sfdx force:data:tree:import --plan data/sample-data-plan.json SFDX allows to migrate both metadata and data However, not too much of data, it is not complete replacement for DataLoader [9]
  • 25. Apex class creation SFDX CLI has commands to create empty apex class, trigger, visualforce page, component and lightning component. sfdx force:apex:class:create -n DebugClass -d classes sfdx force:apex:class:create -n CustomException -d classes -t ApexException sfdx force:apex:class:create -n TestDebug -d classes -t ApexUnitTest sfdx force:apex:class:create -n EmailService -d classes -t InboundEmailService sfdx force:apex:trigger:create -n AccTrigger -s Account -e 'before insert, after update' sfdx force:visualforce:page:create -n Page -l Label -d pages sfdx force:visualforce:component:create -n comp -l compLabel -d components sfdx force:lightning:app:create create a Lightning app sfdx force:lightning:component:create create a Lightning component sfdx force:lightning:event:create create a Lightning event sfdx force:lightning:interface:create create a Lightning interface sfdx force:lightning:test:create create a Lightning test
  • 26. Files creation SFDX CLI has commands to create empty apex class, trigger, visualforce page, component and lightning component. sfdx force:apex:class:create -n DebugClass -d classes sfdx force:apex:class:create -n CustomException -d classes -t ApexException sfdx force:apex:class:create -n TestDebug -d classes -t ApexUnitTest sfdx force:apex:class:create -n EmailService -d classes -t InboundEmailService sfdx force:apex:trigger:create -n AccTrigger -s Account -e 'before insert, after update' sfdx force:visualforce:page:create -n Page -l Label -d pages sfdx force:visualforce:component:create -n comp -l compLabel -d components sfdx force:lightning:app:create create a Lightning app sfdx force:lightning:component:create create a Lightning component sfdx force:lightning:event:create create a Lightning event sfdx force:lightning:interface:create create a Lightning interface sfdx force:lightning:test:create create a Lightning test
  • 27. Pecularities SFDX CLI has commands to create empty apex class, trigger, visualforce page, component and lightning component. However, all other components like SObjects, Fields, Tabs should be created manually and then pulled from scratch organization Each custom object field is a separate file. Each element in zipped static resource is a separate file. No destructiveChanges.xml is needed, just delete the source file, push and it will be deleted from scratch organization
  • 28. Limits How many activetotal scratch orgs can I have in my edition? EE – 40, UE, PerfE – 100, Trial – 20 active scratch orgs. EE – 80, UE, PerfE – 200, Trial – 40 daily scratch orgs allocations. Edition Active Scratch Org Allocation Daily Scratch Org Allocation Enterprise Edition 40 80 Unlimited Edition 100 200 Performance Edition 100 200 Dev Hub trial 20 40
  • 29. Limits How many active scratch orgs do I currently have? Execute command sfdx force:limits:api:display -u DevHub
  • 30. Source conversion How do I convert my existing source to DX? First, you need to create a project sfdx force:project:create -n super_awesome_dx_project Place a folder with old source in project folder, then execute commands sfdx force:mdapi:convert -r mdapipackage/ I have a DX project but I want to use ANT Migration Tool. How do I convert DX project back to ANT migration Tool format? Easy. Just execute commands mkdir mdapioutput sfdx force:source:convert -d mdapioutput/
  • 31. ANT Tasks in DX Can I deploy ant project with DX? Yes. Definitely, just run a command sfdx force:mdapi:deploy -d mdapioutput/ -w 100 You might want to specify alias for target deployment organization with -u flag. How do I perform ANT Retrieve task with DX? Retrieve package sfdx force:mdapi:retrieve -s -r ./mdapipackage -p DreamInvest -u org -w 10 Retrieve unpackaged source sfdx force:mdapi:retrieve -k package.xml -r testRetrieve -u org
  • 32. Licenses support DX After you’ve enabled Dev Hub capabilities in an org, you’ll need to create user records for any members of your team who you want to allow to use the Dev Hub functionality, if they aren’t already Salesforce users. Three types of licenses work for Salesforce DX users: • Salesforce, • Salesforce Platform • and the new Salesforce Limited Access license.
  • 33. Permissions needed To give full access to the Dev Hub org, the permission set must contain these permissions. • Object Settings > Scratch Org Info > Read, Create, and Delete • Object Settings > Active Scratch Org > Read and Delete • Object Settings > Namespace Registry > Read, Create, and Delete To work with second-generation packages in the Dev Hub org, the permission set must also contain: • System Permissions > Create and Update Second-Generation Packages
  • 34. References1. https://developer.salesforce.com/blogs/2018/02/getting-started-salesforce-dx-part-1- 5.html 2. https://developer.salesforce.com/promotions/orgs/dx-signup 3. https://developer.salesforce.com/media/salesforce-cli/releasenotes.htm 4. https://developer.salesforce.com/docs/atlas.en- us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm 5. https://developer.salesforce.com/docs/atlas.en- us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm 6. https://developer.salesforce.com/docs/atlas.en- us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_def_file_config_values.htm 7. https://trailhead.salesforce.com/modules/sfdx_travis_ci 8. https://github.com/forcedotcom/LightningTestingService 9. https://salesforce.stackexchange.com/questions/221991/sfdx-datasoqlquery-fails- on-significant-amount-of-data 10. https://developer.salesforce.com/docs/atlas.en- us.sfdx_setup.meta/sfdx_setup/sfdx_setup_add_users.htm