With a Partial Copy Sandbox can I carry over all function from Production for every object but only sample records for some of the objects?

What I want is to be able to get the functionality for the whole of production into a Sandbox but only bring along sample records for certain objects e.g. not contact records. Is this possible?


You use Sandbox Templates to choose which objects are copied into a full or partial copy sandbox. Some documentation on sandbox templates can be found here. To create a template you will navigate in your Production org to Setup > Sandboxes > click 'Sandbox Template' tab > click 'New Sandbox Template' > Choose the objects you want to include.

Note that if you include some objects, like Accounts, there will be required objects that you must include as well due to relationships on those objects.

| improve this answer | |

To answer your question, a sandbox will always have all of your classes, workflows, triggers, pages, and so forth. A partial copy sandbox will contain a partial copy of the records from your production org, and you CAN specify which objects to copy records from.


There is one major limitation with the partial copy sandbox, that makes it unusable for us, and may affect your decision to use this sandbox type.

The issue relates to how related the records are copied.

When you create a partial copy sandbox, you can select which object's records to copy over (e.g. Lead, Contact, Custom__c, etc).

However, a partial copy sandbox only has 200mb of storage (which is around 100,000 records). So, the system almost randomly selects only some of the records from the selected objects for the new sandbox.

This can cause issues as follows:

  1. Useful records may not be copied.

You cannot specify any useful filtering criteria for which records are passed to the sandbox. As a result, you may have old records that don't reflect current business processes you want to test transferred.

  1. Required related records may not be copied.

Let's say that you have a trigger that relies on a record related to the Account object and you are copying the Account and the related object in your partial copy sandbox.

Let's also say that this lookup field is only populated after an Account has reached a certain stage. When an account is in this certain stage, the trigger expects there to be a value in this lookup. Therefore the field cannot be marked as required as the field is only populated after a certain point.

Any related records will only be copied if the field is Master-Detail or marked as Required (i.e. not null).

All other related records may not be copied (it's random), leaving the lookup field semi-null. By semi-null, I mean the field will contain an ID value, but this value will not relate to any existing record in the new sandbox.

So, this issue will cause an error in your new sandbox if you have triggers/processes/etc that expect a related record to exist for a non-required lookup field.

  1. Rich Text links can cause errors.

Another weird bug can occur if you have a rich-text field on a transferred record that contains a file (e.g. an image). As the field is linking to an image (for example) that doesn't exist in the new sandbox, errors occur. This can actually lock the record through errors making the field unmodifiable, and the record undeletable.

So, partial copy sandboxes may be useful for simple orgs, but for anything with more complex processes, they are nothing but trouble. For our purposes, we use scripts to randomly generate records in our sandboxes to avoid the above issues.

| improve this answer | |

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.