Tuesday, February 13, 2018

Salesforce DX initial guide

Salesforce DX is a VCS from alesforce, if you are working on collaborative projects with a multiple developer then you may need to use git along side with DX.

To start we need to have a Dev Hub org, you will use this to control all your scratch orgs, also you will need Salesforce CLI installed in your local machine.

1. Command to login and authenticate your dev hub user.
sfdx force:auth:web:login --setdefaultdevhubusername --setalias devhub
If you have used only "sfdx force:auth:web:login" then use the below comman to set user to default
sfdx force:config:set defaultusername=test-wvkpnfm5z@example.com --global
Note: find the user list: sfdx force:user:list

2. Download the package from dev hub, you may have some other org as a source also.
sfdx force:mdapi:retrieve -r ./mdapipkg -u <username> -k ./package.xml

3. Convert it to DX project style
sfdx force:mdapi:convert --rootdir mdapipkg/unpackaged

4. Create a scratch org
sfdx force:org:create -f project-scratch-def.json -a devhub

5. Check org and user name
sfdx force:org:list

6. Push the local change to scratch org to start development.
sfdx force:source:push -u <scratchusername>
Repeat point 6 when ever you make any changes in local.

7. Pull changes from your scratch
sfdx force:source:pull -u <scratchusername>

No comments:

Post a Comment