1

If I have custom-setting metadata (or any other custom objects) in a partial-copy sandbox and not in production, then I refresh the sandbox, will that metadata be wiped out and have to be recreated?

I'm working on a sandbox-refresh script and trying to determine how to handle custom settings that are in the sandbox but not in production.

  • 2
    Source control, source control, source control. You can back up all your metadata, perform a refresh of data, and redeploy your stashed changes. – TemporaryFix Feb 19 at 20:52
3

Yes. All of the customizations in your sandbox will be lost:

When you’re finished with a sandbox, you can refresh it. This process replaces the current sandbox with a new copy of your production org.

All metadata customizations will be replaced with a copy of your production Salesforce instance. Data will be copied if applicable for the sandbox type, but any data existing in the sandbox will not be preserved.

Custom Settings and Custom Metadata are copied from Production upon refresh, regardless of sandbox type.

  • 1
    In fact, to go even farther, there's really no difference between refreshing a sandbox and deleting it and creating a new one with the same name, type, and, in the case of partial copy, sampled objects. – Avrom Roy-Faderman Feb 20 at 18:33
2

On top of David's answer, wanted to provide some information around your question:

I'm working on a sandbox-refresh script and trying to determine how to handle custom settings that are in the sandbox but not in production.

With any refresh as David has highlighted, you necessarily get a replica of Production for metadata (and data if it's a partial or full copy sandbox) configurations. This would mean that you will lose all your changes in the Sandbox which are not yet migrated to Production.

For your scenario, you will need to make sure that your Custom Settings are stored as metadata say in source repository. Because you will only be able to store the metadata, you will also need to ensure that the data contained in Custom Settings are also preserved.

Then once you have refreshed your Sandbox from Production, you can then write the script to migrate those Custom Setting and the related data in your new Sandbox.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.