Wednesday, 31 July 2024

Scratch Org Snapshot (Summer 24 GA)

 A snapshot captures the state of a scratch org at a point in time. To update your snapshot, delete it 

and create another snapshot. Unlike an org shape, a snapshot includes installed packages, metadata, and data. 

The time to create a snapshot depends on the size of the source scratch org. To speed up snapshot creation time, 

include only what’s necessary for your project.


A snapshot is a point-in-time copy of a scratch org that includes installed packages, features, limits, licenses, metadata, and data.

 

With scratch org snapshots, you can quickly replicate scratch orgs with the required project dependencies.


3.Create Scratch Org using Definition File


sf org create scratch --definition-file Config/snapshot-scratch-def.json --alias your-scratch-org-alias --target-dev-hub your-dev-hub-alias --wait 10


ex :


sf org create scratch --definition-file config/project-scratch-def-snapshot.json --alias SnappedScratchOrg --target-dev-hub Spring24 --wait 10


The definition file look like below


project-scratch-def.json 

{

"orgName" : "Demo Scratch Org from a Snapshot,

"snapshot" : "Mysnapshot"

}


Create Scratch snapshot using cli command



sf org create snapshot --name <name> --source-org <ID or alias of scratch org> \

--target-dev-hub <username or alias of Dev Hub org> --description <text>


ex :


sf org create snapshot --name dhsnapshot --source-org dreamhouse-scratch \

--target-dev-hub my-dev-hub --description "Dreamhouse app"



Scratch org Snapshot CLI commands


1.Create : org create snapshot

2.List   : org list snapshot

3.Delete : org delete snapshot

4.Get    : org get snapshot


Key features of scratch Org snapshots :

CLI commands to create,list and delete snapshots

Support for Salesforce,Platform and DX Limited Access user Licenses

Allocations per edition : 40 in Enterprise,100 in Unlimited and performance

Max 90 day lifespan

Auto-cleanup of expired snapshots

Auto-upgrade of snapshot version at major salesforce release boundaries

Compatible with package version creations.


No comments:

Post a Comment