Release - November 22
Search…
⌃K

Scratch Org Shape

Learning Objectives

  • How to shape your scratch org which necessary features and settings
  • How to push your local source and pull changes from scratch org
  • Understanding the advantages of source tracking api
Time to complete: 45 Minutes

Prerequisites

Steps

Enable Community in Scratch Org definition file

  • Add communities in features
  • Enable network settings under settings
  • Enable Experience bundle metadata under settings
{
"orgName": "Dreamhouse",
"edition": "Developer",
"features": ["Communities"],
"settings": {
"communitiesSettings": {
"enableNetworksEnabled": true
},
"experienceBundleSettings": {
"enableExperienceBundleMetadata": true
}
}
}

Enable Contacts to Multiple Accounts

  • Add ContactsToMultipleAccounts in features

Set up a new Scratch Org

  • Create a new Scratch Org by using the sfdx force:org:create command
  • Install all the package dependencies to your scratch org
Don't want to use the CLI command over and over installing multiple packages? Try sfdx sfpowerkit:package:dependencies:install

Create the inspection__c custom object

  • Open your Scratch Org using sfdx force:org:open command
  • Go to setup > Object Manager > Create > Custom Object
Field
Value
Label
Inspection
Plural Label
Inspections
Object Name
Inspection
Record Name
Inspection Id
Data Type
Auto number
Display Format
Ins-{000000}
Starting Number
1
  • Create the following fields within Inspection Object:
    • Create a Master detail field to Contact object with Field name Customer
    • Create a Master detail field to Property__c object with Field name Property
    • Create a field with data type Date and API name Inspection_Date
    • Create a field with data type Time and API name Time_Slot
  • Check the status using sfdx force:source:status command
  • Pull the changes using sfdx force:source:pull command

Create account and contact sharing rules

  • Go to Setup > Sharing Settings > Account Sharing Rules > New
The details to be used on the sharing rule

Create new Business Hours for Melbourne

  • Go to Setup > Business Hours > New
The details to be used on the business hours

Recap

Shape is an important concept that one needs to understand while working with Scratch Orgs. Anything that can be applied in shape, can also be applied using Metadata API (settings). This can be a quite daunting task to understand all what has been enabled in an existing org, For this we can use the shape https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_org.htm#cli_reference_shape_create