1

Can installed packages be copied (not installed) into scratch orgs? The same way they get copied to sandboxes.

We have quite a few managed packages installed in our dev hub. I do appreciate we can install them to a scratch org after it gets created, but can we get them copied with their configurations as well?

1 Answer 1

3

No, this is not possible. You must install the managed packages, either through scripting or manually, into each scratch org.

Configuration is stored differently for each managed package - some might use Custom Settings, others Custom Metadata, others sObjects. You'd have to design a route to capture and load the configuration for each managed package's specific strategy.

Disclaimer: I am part of the team building this free and open source product: CumulusCI is designed for this kind of automation, and in particular comes with managed package dependency management for scratch orgs out of the box.

4
  • It's pretty shameful Salesforce didn't build-in package dependency installation based on sfdx-project.json content... we didn't use CumulusCI to resolve this but wrote scripting that uses the sfdx-project.json with some specially named "packageAliases" that hold the dependency package installation keys/passwords (these are nicely retained when sfdx rewrites the JSON file on package version creation which is why we took this approach). You're spot on with the answer though.
    – Phil W
    Feb 23, 2021 at 16:47
  • At some point Salesforce should provide the "scratch org snapshot" concept, of course, which should mean a scratch org can be created from a "template" that already includes the dependency packages... the documentation includes reference to pilot commands for this.
    – Phil W
    Feb 23, 2021 at 16:51
  • Thanks for your answer! Do you also manage to export private custom settings data for managed packages?
    – user39399
    Feb 24, 2021 at 15:57
  • As in Protected Custom Settings? No, that's not possible. You can export and load non-protected Custom Settings.
    – David Reed
    Feb 24, 2021 at 16:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .