Day 8: Create Scratch Orgs using an Org’s Shape

By

2 minutes de lecture

On the 8th day of Christmas we are going to speak about Salesforce Org’s Shape and I bring to you a great new tip from our #TexeiAdventCalendar.

Creating a scratch org with the same features and settings as your production org is not an easy task. To simplify our lives, Salesforce introduces the Org’s Shape which allows you to create a scratch org similar to your production org!

The Org’s Shape refers to features, settings, limits, and licenses. These characteristics will be cloned to your scratch org thanks to this Beta feature.

Salesforce Org’s Shape: how does it work?

To enable this option, you need to follow a few steps:

  • From setup, search for the Org Shape option in the Quick Find Box and select it.
  • Enable Org Shape for Scratch Orgs.
  • If the source org is different from the Dev Hub, enter the 15-character Id of your Dev Hub. You can add up to 50 Dev Hub Ids separated by a line.
Salesforce Org’s Shape
Setup-Org Shape
  • Create an Org Shape, this requires a few SFDX commands that you can find here.
  • Create a scratch org definition file. Instead of indicating the edition you have to indicate the sourceOrg (use the 15-character Id of the org whose shape you created). If you want, you can also add more functionalities that are not necessarily available in the source org. See the example below.
Scratch org definition file example
  • Create a scratch org.

And voilà! You have a brand new scratch org with much more similarities to your source org.

Conclusion

This is a great way to build a more “realistic” development environment. It is simple to keep your scratch orgs updated. You can do this by just creating a new Salesforce Org’s Shape anytime you need to.

You can learn more about this feature here.

Want to continue learning? Check out our next article Salesforce Custom Notifications

 

Read more posts