Seeding a Salesforce Sandbox


Salesforce provides a sandbox that you can use for testing and demo purposes. You can populate (seed) the sandbox with a Metallic backup from your production Salesforce data or another Salesforce sandbox.

Perform granular or bulk seeding by configuring rules or templates that specify the objects that you want to seed and the object records to use for the seeding. If you want to seed multiple objects that are not related, these objects need to be included in the seeding template. The seeding templates will be saved for immediate or future use, consistent reseeding of development or training sandboxes, or to be edited to create new templates.

You can specify any of the following records:

  • All records

  • Records that are returned from a user-defined SQL query

  • Records that have been backed up in the last N number of days

  • The most recently backed up N records

Tip: Due to the complexity and nature of Salesforce, some objects and records might not restore successfully. Issues that can block records from being restored include API limitations, data integrity, complexity in hierarchical relationships, and automation processes that utilize triggers, flows, and rules. To avoid errors or for faster results, disable the validation rules, Apex triggers, flows, and workflows. For the same benefits for managed packages, uninstall the packages. (Managed packages cannot be disabled using APIs.)

Before You Begin

  • Verify that the Salesforce user who performs the restores has the required permissions.

  • In Salesforce, create a destination Sandbox that contains the same metadata as your source organization. The Metallic software does not restore metadata as part of a Sandbox restore.

    For information about creating sandboxes, go to the Salesforce help site, Create a Sandbox.

  • Add an app for the destination organization.

  • Review the objects that are not supported for restores.

  • Verify that you have enough free space (it must be at least the size of the data that you want to restore) for the data and file storage space on your destination Salesforce environment.

  • Verify that the profile, users (communityNickName), and RecordType are the same on the destination and the source.

  • Verify that the objects exist on the destination organization.

  • If you want to mask sensitive data during the restore, configure data-masking policies.


  1. From the navigation pane, go to Protect > Salesforce.

    The Salesforce page appears.

  2. For the organization that contains the data that you want to restore, click the action button , and then click Restore.

    The Select restore type page appears.

  3. On the Sandbox seeding tab, select a sandbox seeding template or create a new one.

    To create a new sandbox seeding template:

    1. Select Create new.

      Alternatively, if you want to make a new template based on an existing template, you can simply clone the existing template. In the row for the template that you want to clone, click the Actions menu, and then click Clone. This will add a new template that is named "Clone of [existing template]." You can change this name later.

    2. In the Name field, enter the name of the new sandbox seeding template.

    3. To add objects, select Add.

      The Add rule dialog box appears

    4. From the Object list, select the objects that you want to seed.

    5. Next to Selection criteria, choose the records that the software adds to the sandbox:

    • To add all records, select All records.

    • To define a filter by using SQL, select SQL where clause.

    • To define the number of records, select Most recently updated N records, and then in the Number of records box, enter the number of records.

    • To define a number of days, select Records updated in the last N days, and then in the Last N days box, enter the number of days.

    1. To include parent objects in the restore, from the parent objects list, select All parents.

      Important: Including parent objects has the following effects:

      • Data integrity is maintained. If parent objects are included and some parents do not exist or some parents have incorrect values, the restore still completes.

      • When objects such as User objects are updated, end users receive notifications, which might not be desirable.

    2. To include child objects in the restore, from the child objects list, select the child objects.

      To exclude some child objects, select the Exclude children check box, and then in the Children to exclude box, select the child objects that you want to exclude.

    3. Click Add rule.

    4. Optional: Create seeding rules for additional objects.

    5. Optional: To apply data masking to the template, select one of the masking policies or create a new one.

    6. Click Save.

  4. In the row for the sandbox seeding template that you want to use, click the Actions menu, and then click Seed sandbox.

  5. In the Destination sandbox organization field, select the Salesforce destination.

  6. In the Options area, select or deselect the seeding options:

    • To associate all restored records in the destination org with the logged-in user as the record owner (if a record owner does not exist in the destination org), select the Associate ownership to the logged-in user check box.

    • Disable triggers and rules: With this option selected, after the restore is complete, the workflows and triggers are automatically enabled.

    • Restore empty fields: This option enables populated fields to be overwritten with blank values.

    • Associate ownership to the logged-in user:If the source Salesforce user does not exist in the destination Salesforce organization, then the restored record ownership will be associated with the logged-in Salesforce user.

    • To associate all restored records in the destination org with the logged-in user as the record owner (if a record owner does not exist in the destination org), select the Associate ownership to the logged-in user check box.

    • Apply masking on destination: To apply data masking, select the Apply masking on destination check box, and then from the Select data masking policy list, select the data-masking policy.

      If the template has a data masking policy, then that policy will be chosen by default when you use that template to seed a sandbox, and you cannot change it.

      Note: Data masking can be applied when a cross-instance restore is run and data masking policies are defined.

  7. Click Run.

  8. In the Confirm submit dialog box, review the information about the restore and click Confirm.


After the operation completes, the destination sandbox contains the records that meet the rules that you configured.

SQL WHERE Clause Examples for Salesforce Restores