# 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 Commvault backup from your production Salesforce data or another Salesforce sandbox. Data is restored from a local (sync) database.

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 Commvault 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. For sandbox seeding, you cannot restore objects such as attachments and ContentVersion.

- Verify that you have enough free space (it must be the size of the data that you want to restore):

  - If you restore from media, then the free space must be available on the staging database.

  - If you restore from the database, then the free space must be available on the catalog database.

  - You must have enough 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.

- (Commvault software only) Verify that the Web Server can communicate with the sync database by opening the necessary default ports.

## Procedure

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

   The Salesforce Overview page appears.

2. Go to the Organizations tab.

3. In the Name column, click the app.

   The app details page appears.

4. On the Sandbox seeding tab, in the row for the sandbox seeding template click the action button , and then click Seed sandbox or create a new template.

   Need help creating 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 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 a name for the template.

   3. (Optional) Select a data masking policy.

   4. For each object that you want to seed, add a corresponding rule. To add the first rule, click Add next to the Objects grid.

      The Add rule dialog box appears.

   5. From the object list, select the objects for the rule. One, multiple, or all objects can be selected.

   6. In the next dropdown, select a rule:

      - All records: To seed all available records for the object in the latest backup.

      - Most recently updated N records: With this option selected, specify the number of records, N in the Number of records box.

      - Records updated in last N days: With this option selected, specify the number of days, N in the Last N days box.

      - SQL Where clause: To define an advanced SQL filter, using a combination of rules and rule groups.

   7. To include parent objects in the restore, move the Restore parent object records toggle to the right.

      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 may be undesirable.

   8. To include dependent objects in the restore, move the Restore dependent object records toggle to the right and then select Immediate or All for Dependent object level.

      By default, the Commvault software selects all the dependent objects based on your selection for Dependent object level. From the Included dependent objects list, you can select the dependent objects that you want to include in restore.

   9. Click Add rule.

      If you added multiple objects, each has its own row. Add more rules as needed.

      To view the records for an object, click the action button , and then Preview.

   10. Click Save.

5. In the Destination details section, from the Destination sandbox organization list, select the Salesforce organization.

6. To map the records between Salesforce organizations in case of out-of-place restores, click Edit Field Mappings.

   The Field mappings window appears.

   To add a new field mapping, click Add object and then specify the Object name and Field API name and click Save. For information on field mappings, see Field Mappings for Salesforce Restores.

7. To disable the Salesforce triggers, flows, workflows, and rules only for the restore, select the Disable triggers and rules check box.

   After the restore completes, the flows, workflows, and triggers are automatically enabled.

8. To overwrite non-null field values with the null or empty field values from the backup, select the Restore empty fields check box.

   For example:

   - Backup record: `{id: "abc", name__c: null}`

   - Salesforce record: `{id: "abc", name__c: "custom_name"}`

   - Salesforce record after the restore: `{id: "abc", name__c: null}`

9. 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.

10. To apply data masking, move the Apply masking on destination toggle to the right, and then from the Data masking policy list, select the data-masking policy.

    Note

    You can apply data masking when you run a cross-instance restore and data masking policies are defined.

11. Click Run.

12. Click Confirm.

×

Loading...