Prerequisite:
Enable “Dev Hub” in your Production Org.
1. Log in to the Dev Hub
To authorize the Dev Hub, use the web login flow
sfdxauth:web:login -d -a DevHub
Log in with your credentials
sfdxforce:org:open -u DevHub
2. Create Scratch Org
project-scratch-def.json
{ “orgName”: “Cybersource”, “edition”: “Developer”, “features”: [“Communities”, “B2BCommerce”, “OrderManagement”], “settings”: { “lightningExperienceSettings”: { “enableS1DesktopEnabled”: true }, “securitySettings”: { “passwordPolicies”: { “enableSetPasswordInApi”: true } }, “experienceBundleSettings”: { “enableExperienceBundleMetadata”: true }, “communitiesSettings”: { “enableNetworksEnabled”: true }, “orderManagementSettings”: { “enableOrderManagement”: true }, “orderSettings”: { “enableOrders”: true, “enableEnhancedCommerceOrders”: true, “enableOptionalPricebook”: true } } }
sfdxforce:org:create -s -f config/project-scratch-def.json -a GeoAppScratch -v devHub -d 30
- The -s option indicates that you want this scratch org to be the default org for this project when running Salesforce CLI commands. To use a different org on a per command basis, you can specify the -u argument and specify another alias.
- The -f option is the path to the project scratch org configuration file.
- Remember our friend, the -a option, from the previous unit? It lets you refer to the org using its alias, GeoAppScratch, in future commands that accept the -u parameter.
We don’t recognize this namespace: cybs. Did you register it in your Dev Hub org?
Link the namespace in devHub
3. open scratch org
sfdcforce:org:open -u <scrachOrgalise or username>
4. Push code to sratch org
sfdx-project.json is required
{ “packageDirectories”: [ {“path”: “force-master”, “default”: true}, {“path”: “force-billing”} ], “namespace”: “cybs”, “sfdcLoginUrl”: “https://login.salesforce.com”, “sourceApiVersion”: “50.0” }
5. Set expiration date