Scratch Org in Salesforce

Scratch Org feature in Salesforce helps Source Driven Development.

The scratch org is a source-driven and disposable deployment of Salesforce code and metadata components. This feature is made for developers and for deployments automation (CI/CD). A scratch org is fully configurable, allowing developers to emulate/simulate different Salesforce editions with different features and preferences.

To create a Scratch Org using VS Code:

https://www.infallibletechie.com/2022/11/how-to-create-salesforce-scratch-org-using-vs-code.html

To push changes to the Scratch Org:

sfdx force:source:push --targetusername <Scratch Org Username>

Scratch Org Expiry:

When you create a Salesforce Scratch Org, you an specify the expiry for it. Specify the scratch org’s duration which indicates when the scratch org expires (in days).

sfdx force:org:create -f config/project-scratch-def.json --durationdays 30

To build a sample scratch org, check https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_def_file.htm

Additional information – https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs.htm

Trailhead Resource – https://trailhead.salesforce.com/content/learn/projects/quick-start-salesforce-dx/create-and-test-our-scratch-org

Leave a Reply