Records to Restore Editor

The “Select Records” tab on the “Restore Set Editor” determines which records will be restored to Salesforce.  The “Select Records” tab is divided into two major sections:

  • The top section is is common to all techniques available for finding records to restore.
  • The bottom section contains parameters unique to a specific record finding approach.

The following image illustrates the primary elements in this tab.

Common Parameters

Which Records

The “Which Records” option provide a large number of  techniques for determining what records to restore. The techniques include:

Technique Description
All Restore all records from the CopyStorm backup.
Filter Use a rich GUI to create a filter limiting which records are restored.
Id File Provide a file of Ids listing the records to restore. The “ids” can be any Salesforce “Id” or “String” type column.
Id List Paste in a list of Ids listing the records to restore. The “ids” can be any Salesforce “Id” or “String” type column.
Random Restore a random number of records, optionally using a filter to control which records can be selected.
Referenced Only restore records which are referenced by another table.
SQL Write SQL against the CopyStorm database to determine which records to restore. This technique is for advanced developer types.
None No records will be restored. This can be useful to suppress restores to a table when pending records are already in the tracker database.

Restore Type

The “Restore Type” options determines what kinds of operations are allowed when writing to Salesforce.

  • Updates only
  • Inserts only
  • Both Inserts and Updates

By default both inserts and update are allowed unless a required field is excluded. When a required field is excluded then Inserts are automatically disallowed.

Record Match Policy

The “Record Match Policy” options determines how CopyStorm/Restore decides whether to update an existing record or and insert a new record when writing to Salesforce. The follow policies are supported:

(Note: for all polices a CopyStorm->Salesforce Id match check will be attempted if the base policy fails to find a match).

Matching Policy Description
Salesforce Id If the record Id in CopyStorm matches an existing Id in the target Salesforce then an update operation is performed. Otherwise an insert operations is performed.
External Id If a specific External Id column in CopyStorm matches the same column in Salesforce then an update operation is performed. Otherwise an insert operations is performed.
Multi-Column If one or more specified columns matches the same columns in Salesforce then an update operation is performed. Otherwise an insert operations is performed.

The following two images illustrate the “External Id” and “Multi-Column” record matching policies

Other Common Parameters

Other parameters in the top section are less common to be set by a user. They include:

Parameter Description
Max # Per Update Maximum number of records to be sent to Salesforce in a single batch. By default use the parameter from the Global Parameters tab. Never set this value unless something like an ApexTrigger or Workflow is limiting the number of records that can be written in a batch. This condition typically occurs as a result of poorly written Apex code.
# Salesforce Writers Maximum number of concurrent write request to Salesforce. It is rare to set this value because CopyStorm/Restore dynamically selects a value which gives optimal performance as part of its runtime Salesforce analysis.
Skip Record Id Check Tell CopyStorm/Restore that all operations will be Inserts. This will save a little time by avoiding the check to see if a record is already in the target Salesforce.

Restore All Records

The “All” option will restore all records in the CopyStorm backup to the Salesforce instance:

Restore Filtered Records

The “Filter” option will restore records that match a drag-and-drop set of criteria in the CopyStorm backup to the Salesforce database. To use a record filter to select records in CopyStorm, please see the page here: Limiting Records To Restore With a Record Filter.

Restore Using an Id File

The “Id File” option will read “ids” from a file and restore all records which match the supplied ids.

The field to treat as the “id” is selected from the pull down menu. Of course, a 15 or 18 character Salesforce Id will always work (and is the default).

However, all Salesforce Id and text fields can be used. For example you could:

  • Use BillingState as the “id” and select all accounts in Florida and Alabama (the Ids values would be Florida and Alabama).

Restore Using an Id List

The “Id List” option will restore Salesforce records based on record Ids copied into a text box. Ids should be delimited using a space or a comma.

  • There is no practical limit to the number of Ids you can paste into the box.
  • You can choose any Salesforce Id type column or text column to use as the “id” field.

Note: For real Salesforce Ids use a 15 or 18 character id.

Restore Random Records

The “Random” option will restore a random number of Salesforce records, optionally limited to a set of Ids provided based on a SQL statement or record filter.

If a value is provided for the “Seed” parameter the same records will be restored each time.

  • This can be useful for restoring a development sandbox to exactly the same state every time.
  • The “Seed” parameter can be any positive non-zero number from 1 to 9 digits in length.

To restrict records using a record filter, select “Filter” from the “Constraint Type” dropdown and:

  1. Click on “Click Here To Edit”.
  2. See this page for more information on configuring a record filter in CopyStorm/Restore: Limiting Records To Restore With a Record Filter.

To restrict records using a SQL statement, select “SQL” from the “Constraint Type” dropdown and:

  • Example 1: Limit the selection to accounts with a shipping country of “Elbonia”:
    • SELECT id FROM Account WHERE ShippingCountry=’Elbonia’
  • Example 2: Limit accounts to those with Opportunities having a value greater than $1,000,000:
    • SELECT DISTINCT accountId FROM Opportunity WHERE amount > 1000000

Restore Referenced Records

The “Referenced” option will only restore a record if it is referenced by another Salesforce record being restored. This option is selected automatically as a side-effect of including a related list for another table.

For example, if a user selects random Account records to restore and selects the Opportunity related list, a rule to restore referenced Opportunities will automatically be created.

When creating test data in a sandbox restoring referenced records may cause more data than desired to be restored. For example, if restoring all Cases referenced by restored Accounts, much more data than needed may be restored.

There are three parameters which can control the number of referenced records to be restored:

  • The “Max # Per Parent” is the maximum number of child records that should be restored for each parent.
    • For example, if this number is 5 for restoring Cases, then no more than 5 Cases will be restored for each unique Account.
  • The “Max # Total” is the maximum number of child records that should be restored for all parents.
    • For example, if this number is 200 for restoring Cases, then no more than 200 Cases will be restored in total.
  • The “Constraint Type” allows the restored records to be limited to referenced records that match a specific set of criteria.
    • Select “Filter” to edit a drag-and-drop record filter that will be used to limit the related objects being restored.
    • Select “SQL” to provide a SQL fragment that will be added to the WHERE cause of the SQL used to look for related objects.
      • For example, if this is set to “closeDate >= ‘2015-01-01′” for Opportunity then only Opportunities in 2015 or later will be selected.
      • Any column in the CopyStorm backup database can be used to form this constraint.
      • The only restriction for this parameter is that it must be valid SQL when appended to a statement like:
        • SELECT id FROM Opportunity WHERE (…) AND (<>)

Note that the actual number of referenced records restored may be slightly larger than the specified constraint. This is because records are also restored because of a reference field constraint, but the number of additional records restored is typically small.

Restore Records by SQL

The “SQL” option will restore all records whose id matches the value returned by a user supplied SQL statement.

For example,

  • To select Contacts in Ohio:
    • SELECT id FROM Contact WHERE MailingState=’OH’
  • To select Contacts with open support cases:
    • SELECT contactId FROM Case2 WHERE isClosed=0