In our experience, we have seen multiple scenarios where clients need to copy one org to another outside of the normal sandbox refresh offered by Salesforce.
Occasionally the orgs that need to be copied do not have a production-sandbox org relationship with each other.
Sometimes they need to set up another brand new production Salesforce org using an existing production org as the starting baseline. This could be the case when a company is splitting into two companies for example.
This can represent a fairly unique challenge. For large and highly customized orgs, the deployments would range in tens of thousands of components. The errors encountered during validations could number in the thousands.
Doing it in manageable chunks, and with a well-known standardized process will take the pain out of completing these types of deployments. This document aims to outline the best practice for this process.
Note before beginning: Both of the orgs being used must have the same versions of installed packages otherwise this exercise could be very time to consume and unsuccessful. This is because new components cannot be deployed to a namespace that does not exist. If the different components are embedded in other objects, then it is impossible to deploy those objects as well.
Note: This process has previously been utilized to sync orgs where the initial differential was above 35000 components.
1. Connect both of the orgs to Flosum.
2. Create zero-day snapshots of both orgs using the settings for creating ptimized DeploymentsO: (https://support.flosum.com/hc/en-us/articles/115010425908-Optimizing-your-deployment)
3. Do a snapshot comparison keeping the target org on the right. This will allow all the components that are in the source but not in the target to be part of the output which can then be added to a deployment.
4. You can create a single deployment out of the differential presented or do step 3 twice and create 2 deployments dividing the components between the 2 deployments based on recommendations on Step 1 and Step 2 shared in the above URL.
5. Deploy the static resources etc. first. Fix any errors that arise and deploy until successful
6. Validate the deployment with rest of the resources. Try to correct errors that are easily fixed. If you can deploy successfully, great.
7. If not, start removing the elements that you are having trouble with and do validations until successful. Then deploy. This will probably have your orgs about 70% in synch.
8. Create zero-day snapshots of both orgs again, this time NOT using the settings for optimized patches.
9. Do a snapshot comparison keeping the target org on the right.
10. Create a deployment from the differential. This deployment will have components at a more granular level rather than embedded into other components e.g. custom fields will be available independently as components as opposed to being embedded in custom objects.
11. Validate and fix the errors and dependencies until validation is successful.
12. Then deploy.