Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Parameters for controlling CopyStorm/Restore job logging and informational output.

SOQL Log File
If set to a writable file, CopyStorm/Restore will log each SOQL statement issued to Salesforce..
Truncate SOQL Log on Restore
If checked, CopyStorm/Restore will truncate the SOQL Log File at the start of each restore operation.
Truncate Error Log on Restore
If checked, CopyStorm/Restore will truncate the restoration error log at the start of each restore operation.
Enable Trace Mode
If checked, CopyStorm/Restore will log details about the restore process to stderr. This option is typically used when Capstorm is diagnosing a problem.
Record Lineage specific parameters. Record Lineage maps a logical record to one or more physical forms over time, tracking how the record evolves within the same system or across different systems.

Create Record Lineage
If checked, CopyStorm/Restore will create a lineage entry when a record is inserted. If unchecked, no lineage entry will be created on insert.
Enable Record Lineage Candidate Scanning
If checked, CopyStorm/Restore will consider record lineage when performing a candidate scan. If unchecked, CopyStorm/Restore will not consider record lineage during Candidate Scans. Refer to this article for details on how lineage affects Candidate Scanning.
Related Lists Scan Option
Configures how CopyStorm/Restore manages related list relationships when determining record lineage during the restoration process. Available values are:
Do Not Scan Old Lineage – When performing a candidate scan, only the related lists of the HEAD lineage are scanned.
Require Consistent Relationships – When performing a candidate scan, child records are scanned only if they maintain a consistent relationship with the parent’s HEAD.
Scan Old Lineage – When performing a candidate scan, lineage is ignored, and all child records are considered..
Reference Field Scan Option
Configures how CopyStorm/Restore manages reference field relationships when determining record lineage during the restoration process.
Do Not Scan Old Lineage – When performing a candidate scan, only the referenced records of the HEAD lineage are scanned.
Require Consistent Relationships – When performing a candidate scan, referenced records are scanned only if they maintain a consistent relationship with the parent’s HEAD.
Scan Old Lineage – When performing a candidate scan, lineage is ignored, and all referenced records are considered..
A handful of Salesforce tables can be children of many other types of tables. Good examples include Attachments and Notes.
If you want to include the Attachments for all selected tables, one way is to open the restore rule for each table and include Attachments as a related list. Another quicker way is to open the Attachments editor and quickly select all possible parents using a GUI extension that only appears on tables like Attachments.

On the screen shot, Attachments for Contacts, Leads, etc. can be included in the restore set simply by checking the box next to the parent table name. Though this action is equivalent to adding Attachments as a related list, you will find this technique must faster for larger restore sets.

Parameters in this tab are less likely to be configured by the average user. They include:
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
When enabled, CopyStorm/Restore will avoid the check to see if a record is already in the target Salesforce. Note that when “Skip Record Id Check” and “Skip Original Id Check” are both enabled, all operations will be Inserts.
Skip Original Id Check
When enabled, CopyStorm/Restore will avoid the check to see if a record has already been restored to the target Salesforce by checking the “Original Id” column. Note that when “Skip Original Id Check” and “Skip Record Id Check” are both enabled, all operations will be Inserts. Note that this option will only be displayed if the “Original Record Id” Migration feature is enabled.
The Migration Setup tab contains tools which are useful when migrating data to a Salesforce instance unrelated to the Salesforce instance used to create the CopyStorm backup.
This is useful when trying to perform tasks like:
Mapping Users in a CopyStorm backup to users in the target Salesforce. In this case, Salesforce Ids will not work due to being unique to a Production or Sandbox instance’s setup. The Record Mapping Rule tool on this page supports implementing and establishing rules that CopyStorm/Restore will use to map users from the CopyStorm backup to users in the target Salesforce.
Maintaining Salesforce Ids in a CopyStorm backup when creating data in the target Salesforce. In this case, Salesforce Ids will be regenerated when data is inserted. The Original Record Id Rule tool on this page supports creating and populating a new custom field to maintain the source CopyStorm database Id values.

The Original Record Id Rule tool is used to create a custom field in the target Salesforce and populate the new custom field with record Ids from the CopyStorm backup database. This is useful in a number of migration scenarios when the original Id of records being migrated must be maintained.
For example:
The Original Id may be used after the migration to correlate data between the source and target orgs.
Salesforce Id may be used as a key by an external system which must be able to access the original Salesforce Id.

Original Id field creation is enabled by checking the “Enable this Feature” checkbox. Available options include:

Enable This Feature
Check this checkbox to enable Original Id column creation and population.
Field API Name
The Salesforce API Name of the Original Id field. This field will be created automatically if it does not already exist.
Field Label
The Label to use when creating the Original Id field.
Permission Set Name
When creating an Original Id field on a Salesforce Object, CopyStorm/Restore will update this Permission Set to allow access to the new field. This permission set will be created and assigned to the CopyStorm/Restore Salesforce User if it does not already exist.
Field Description
The Description to use when creating the Original Id field.
The Restore Order tab lists the order in which tables will be inserted / updated into Salesforce.
The order is determined using:
The metadata from Salesforce to determine nearly all relationships.
Additional configuration information in CopyStorm/Restore.
This is used to supplement inaccurate or incomplete Salesforce metadata.
CopyStorm/Restore attempts to restore tables in an order which will minimize the number of reference fields patched during a second pass — the following screenshot shows an example restore order:

The Restore Order Detail tab lists the order in which tables will be written to Salesforce according to the list specified in the Restore Order tab.
The following examples reference the screenshot below.
If a table name appeared in the Required Prerequisites column for Account it means that CopyStorm/Restore’s table scanning algorithm decided to write Account records to Salesforce even though the Account table contains a non-nillable reference column referencing a table later in the list of tables to be restored. In practice, this should never happen in a plan built by CopyStorm/Restore. However, if it does, this plan will show the issue and allow overriding Salesforce dependencies to fix the problem.
If a table name appeared in the Nillable Prerequisites column for Account it means that CopyStorm/Restore’s table scanning algorithm decided to write Account records to Salesforce when the Account table had a nillable column referencing a table later in the list of tables to be restored. This condition happens fairly frequently in Salesforce, and CopyStorm/Restore attempts to reduce the impact on restoration performance by optimizing table ordering. This condition is not an error but means that CopyStorm/Restore will patch up nillable reference fields in a second pass, after the records have been restored.

The Set Records to Skipped tool directly sets the status of records to Skipped, causing CopyStorm/Restore to never attempt to restore the records. This is useful in a number of cases where records are identified in the candidate scan, but:
It is known that the records will have problems if they are restored, but the record scanning results need to be kept.
They are being held back from the current restore operation in preparation for being restored later.
The following screenshot shows available options on the Set Records to Skipped dialog:

The Show Skipped Reasons tool displays the reason(s) why CopyStorm/Restore failed to restore records.
Skipped records are organized using two parameters:
Category — the general type of reason a record was skipped.
Most reasons use the category “Default” but some, like Lead, may use the category “Unsupported”.
“Unsupported” reasons are due to the Salesforce API not supporting the operation.
Table — the name of a table with skipped records.
These parameters may be set at the top of the Show Skipped Reasons dialog. If not set, all values are displayed. In addition a search string may be specified, limiting displayed records to those whose reason contains the search string.
The following additional operations are supported:
The “Delete” button deletes skipped reasons from the tracker database.
The “Export” button saves skipped reasons to a CSV file.

The Delete Records tool deletes records from the Tracker Database. The most common use case is:
The candidate scan found too many records. I want the application to forget about previously found records.
Using the Delete Records dialog requires making two decisions:
Which records should be deleted.
Which record statuses should be affected.
Default parameters delete all visible skipped and pending records.
Records to Delete
“Visible”: Delete all records currently shown in the Tracker table, taking filters into account.
“Table”: Delete all records in the Tracker table, not taking filters into account.
“All”: Delete all records from all Tracker tables.
Selected Record Status
Only delete records with the selected statuses.
Limit Delete To
Records that have been deleted from the target Salesforce.
Only delete records that were previously restored and no longer present in the target Salesforce.
Records that are missing in the CopyStorm database.
Only delete records that were previously found in the CopyStorm database but no longer present.
Other Tracker Data to Delete
Exceptions: Delete all Exception logging history from the tracker.
Skipped Record Reasons: Delete all record skip logging history from the tracker.
Restore History: Delete all Restore job logging history from the tracker.
The Revert Pending tool undoes operations that set previously inserted or updated records to a pending state. This tool will change the state of records from Pending back to Inserted or Updated. The use case for this tool is:
I accidentally reset a group of records to Pending and need to undo the change.
This tool only works on records where both the Original Id and Restored Id are non-blank (i.e. records that have previously been Inserted or Updated).
There is one decision to make when using this tool:
What records should be reverted from Pending back to Inserted or Updated?

The Record Mapping Rule tool is used to create rules telling CopyStorm/Restore how to map between records in the CopyStorm backup to records in the target Salesforce. This is very useful for migration in mapping Salesforce users and a variety of core Salesforce configuration records.
For example:
Mapping Salesforce Users by their email address.
Map Record Types based on record type (where the names are not the same in CopyStorm and the target Salesforce).
CopyStorm/Restore includes default mapping rules for a few common tables. However, these rules do nothing by default because no specific mappings are supplied.

Additional tables can be added by clicking on the “Add Record Mapping Rule…” button at the bottom of the tool.

To add or modify the mappings for a specific table, click on the “Edit” button next to its name. A dialog will appear showing existing mappings allow them to be edited or removed and allowing additional mappings to be imported from a CSV file.

When the Save Changes button is clicked, CopyStorm/Restore will validate the mapping rules looking for entries that are missing in either the CopyStorm database or in Salesforce. Though missing entries will be silently ignore during the restore process, cleaning them up is almost always the right choice.

In addition to mapping rules provided on the Migration Setup tab, CopyStorm/Restore will always map records using a handful of built-in mapping rules. Mappings on the Migration Setup tab will override the default mappings.
User
Field matching on Email
Profile
Field matching on Name
UserRole
Field matching on Name
Group
Field matching on DeveloperName and Type
RecordType
Field matching on Name and SObjectType
Pricebook2
First map the Standard Pricebook in CopyStorm to the Standard Pricebook in Salesforce, then use field matching on Name
Organization
If the CopyStorm database contains 1 Organization, map it to the current User’s Organization. If this does not map, the CopyStorm database contains conflicting information from multiple Salesforce instances.
The Overrides tab supports adding and removing relationships between tables, and is an essential tool when Salesforce metadata contains inaccuracies or ambiguities. In practice, options on this page should not be changed unless instructed to by Capstorm support.
Most of the overrides necessary are probably already built into CopyStorm/Restore and you will not need any additional overrides.
The Salesforce Asset table showcases the need for overrides in order to build a good restore plan. The Asset table’s metadata claims that both of the ContactId and AccountId columns are nillable. Though technically true, it is also true that both Account and Contact must be restored before asset because the Asset table does not allow both Asset.ContactId and Asset.AccountId to be null. CopyStorm/Restore forces the correct order for restoration by overriding the relationships between Asset/Contact and Asset/Account to be required for the purposes of deciding the order in which tables are restored.
If this was done using the GUI, the entry would have:
A Rule Type of Forced
A Parent Table of Account
A Child Table of Asset
A similar rule would be defined for the Contact/Asset relationship.
There are several types of dependency rules that can be added.

A Forced Dependency rule states that all records in a parent table must be restored before records in a child table.
An Ignored Dependency rule states that CopyStorm/Restore should ignore a parent/child table relationship even if it is defined in Salesforce metadata. An example of this is the relationship between ContentDocument and ContentVersion. The ContentVersion table must be restored before ContentDocument because the only way to create a ContentDocument record is as a side effect of creating a ContentVersion. However, Salesforce metadata declares that there is a non-nillable parent/child relationship from ContentDocument to ContentVersion.
A Pseudo Dependency rule states that CopyStorm/Restore should act as if there is a required relationship between two tables even when Salesforce metadata indicates no relationship. The purpose of this rule is to force one table to be restored before another.
The Set to Pending tool resets the Track Database back to a “Pending” state, causing CopyStorm/Restore to attempt to restore the records again. This is useful in a number of cases:
A validation caused records to be skipped during a previous restore. The validation rule was then disabled and the records should now be restored.
Records were previously restored but the data in the CopyStorm backup has changed. Previously restore Salesforce data should be overwritten.
Records in Salesforce were deleted by hand and should be re-restored without losing the tracker history.
The following screenshot shows available options on the Set to Pending dialog:

There are a few decisions to make when using this dialog:
Choose which records to reset to pending.
Choose which record statuses can be affected.
Default parameters will change all visible skipped records to a pending state.
Records to Reset to Pending
“Visible”: Only change the status for records that are currently displayed in the Tracker Database table, taking filters into account.
“Table”: Change the status for all records in the currently selected table, do not take filters into account.
“Select Tables”: Change the status of one or more tables in the tracker.
Record Status to Reset
Only change the status of records with the selected status or statuses.
Other Options
Limit changes to records updated in the CopyStorm database since the most recent restore.
Change the status only for records with a modification timestamp newer than the timestamp the record had when it was restored.
Only records that have been deleted from the target Salesforce.
Change the status only for records that were previously restored but are now missing from Salesforce.
Clear the Restored Id field for each record.
In addition to changing the record status, remove the “Restored Id”.
Though a Partial or Complete restore of a meta data element usually works, sometimes it is necessary to edit the raw XML that will be deployed to Salesforce. The Export Mode restore type provides this feature plus a few others.
The raw data for the current partial restore, any backup in Capstorm, or the current Salesforce definition can be loaded and edited.
Differences between what will be deployed can be quickly compared with the current partial restore, any backup in Capstorm, or the current Salesforce definition.
Finding all occurrences of a pattern can be quickly performed.
Note that in Export mode, the raw data to deploy for an object is stored in the copyStormRestore file as part of the restore session configuration.
To restore a meta data object using the Export mode, simply choose Expert from the restore type pull-down menu.

The metadata to load into the left or right panels is selected using two different pulldown menus.
The “Base Version” pulldown loads metadata into the editor on the left.
The “Compare With Version” pulldown loads metadata into the comparison viewer on the right.
You will see several types of options in the pulldown menu.
Current Backup
Load the most recent back found in the CopyStorm database.
Current Partial
Load the metadata corresponding to the current partial selection for the metadata object.
Current Salesforce
Load the current definition from the target Salesforce instance.
Custom
Load metadata that the user has edited in this or a past session of CopyStorm/Restore.
2020-01-10 14:34:50
Load the backup from the CopyStorm database which was created on the specified date.
The following screen shots illustrate how differences are displayed when the metadata on the left and right differ. For the example an ApexTrigger metadata objects was selected.





There two techniques for searching metadata.
Differences will be calculated automatically and can be systematically walked thru using arrow control on the right.
Specific text can be found by entering a regular expression in the Find parameter. These, too, can be systematically walked thru using arrow controls on the right.

Commonly used parameters that affect the complete restoration process.

Ignore Timestamps
If checked, CopyStorm/Restore will overwrite records in Salesforce even if they have matching modification timestamps. If unchecked, CopyStorm/Restore will skip records with matching modification timestamps.
Decrypt Compliance Data
If checked, decrypted compliance data will be pushed to Salesforce. This data may, or may not, be obfuscated based on the database user’s role. If unchecked, data will be pushed to Salesforce directly from the CopyStorm database, as-is.
Show Missing Fields
Include fields that are missing from the CopyStorm database or from Salesforce when displaying available fields to restore in the Restore Set Editor.
Show Formula Fields
Include formula fields when displaying available fields to restore in the Restore Set Editor.
Referenced Record Not Found Default
Default action to take when a record to restore references a record that is not in the target Salesforce instance.
Examples:
A Case record restore candidate references a Contact no longer in Salesforce.
An Account record restore candidate references a parent Account no longer in Salesforce.
Available values are:
Set to Null – ignore a missing reference and set the column to NULL in the target Salesforce.
Skip Record – do not restore a record if a referenced record cannot be found in the target Salesforce.
Create Record – create missing referenced records in the target Salesforce if necessary.
If Email Deliverability is Enabled
Default action to take when Email Deliverability is enabled in the target Salesforce instance.
Possible default actions If Email Deliverability is Enabled are:
Continue – Continue the restore.
Warn – Display a warning dialog prior to running a restore.
Halt – Terminate the restore entirely.
For production restores Halt is generally the best default option. This is to prevent unwanted emails being sent out on INSERTS/UPDATES
Note: The Author Apex Salesforce Permission is required to validate Email Deliverability.
If the Author Apex permission is unavailable, CopyStorm/Restore will always act as if Email Deliverability is enabled.
The CopyStorm/Restore Tracker database contains information about records that can or will be restored. The following screenshot was taken after a restore operation was partially completed:
Object
Filters displayed records by object name. Only objects which are part of the restore set are listed.
Show Fields
Only displays certain fields based on the specified option. Options include:
All — show all fields.
None — show Original Id, Restored Id, and Restore Status.
Choose Fields — select specific fields to show.
Tool
Use Tools to modify records in the Tracker Database. Tool options include:
Filter Type
The type of filter to use. Options include:
Simple
Advanced
Filter visible records using a .
Record Type
Filters displayed records by restore status. Options include:
All — show all records.
Inserted — show records that were inserted into Salesforce.
Updated — show records that were updated in Salesforce.
Skipped — show records that were skipped by CopyStorm. Clicking on the status value will display a popup with the skipped reason.
Field
Lists all columns which support filtering by text.
Contains
Lists options for interpreting the text following this pulldown. Options include:
Contains — show any record containing the filter string.
Equals — show any record matching the filter string exactly (case insensitive).
StartsWith — show any records starting with the string.
Apply
Causes the current filter to be applied to the data.
Clear
Causes the current filter to be removed.
The middle part of the dialog shows the status of each record and the corresponding data from the CopyStorm backup.
The first three columns contain tracking data for each record, the remaining columns contain record data from the CopyStorm backup. The “Name” column always appears first, other columns appear in alphabetical order.
Original Id
The unique Salesforce Id for the record in the CopyStorm backup.
Restored Id
The Salesforce Id the record was restored to in Salesforce. If the record was restored via an update, the value will be the same as the Original Id. Otherwise the value will be different.
Status
The restoration status of this record. Values include:
Inserted — this record has been added to Salesforce as a new record.
Updated — this record has been added to Salesforce by updating an existing record.
Skipped — this record was not restored to Salesforce. Click on the status to view the underlying reason.
Pending — this record is waiting to be restored.
The Tracker Database can be queried directly using tools like SQuirreL, or any other H2 database browser.
Database schema documentation can be found here.
The Notifications Tab contains parameters used to control who receives a status email when a non-GUI CopyStorm/Restore job runs and under what circumstances email is sent. CopyStorm/Restore supports email notifications via SMTP or via a Salesforce SOAP API call.
Send Email To
Yes
Notification emails will be sent to this white space separated list of email addresses.
Subject
The “Test Email Delivery” button causes an email to be sent to the recipient list. If communication to the SMTP email server or target Salesforce org is successful an acknowledgement dialog will be displayed and an email will be delivered to the recipients.
If communication to the SMTP email server or target Salesforce org fails, a dialog will be displayed showing the error. In this case you should show the error to your local administrator.
CopyStorm/Restore organizes tables into groups based on the probability of a table being directly selected for a restore. There are a number of groups predefined by CopyStorm/Restore:
Common
Tables that are typically used to drive a restore. A table is put into this group if it is added to the restore set and not also a member of another group.
Less Common
Tables that are typically only restored because they are referenced by another table.
Uncommon
Tables that are typically not restored. Many of these are restored automatically on a sandbox refresh.
It is possible to add tables to an existing group or to create additional groups by editing the file “SalesforceTableFamilies.xml” in the “config” subdirectory of the CopyStorm/Restore installation. The default file contains documentation detailing how to add new records.
Several sample entries are included below.
All of the GEOCACHE custom tables begin with the prefix “geocache__” — this was determined by looking at the registered package prefix in Salesforce. The following XML will put all GEOCACHE tables into the Package group:
The following XML will create a new Group named “MyProject”, containing three tables:
Pending — show records waiting to be inserted or updated in Salesforce.

Custom
Contains all custom object tables (i.e. tables not created by Salesforce).
Package
Contains custom objects from well-known 3rd party packages. Not all packages are known by CopyStorm/Restore — please contact support@capstorm.com to add a new one to the built-in group.
System
Contains tables that are almost never restored. Most of these tables are restored automatically on a sandbox refresh.
Future
Contains tables that are not currently available to be restored but will be in the future. Tables in this group tend to have obscure, non-standard restore rules.
Not Restorable
Contains tables that cannot be restored using the Salesforce API.
<SalesforceTableFamily name="Package">
<Pattern rule="geocache__.*" />
</SalesforceTableFamily><SalesforceTableFamily name="MyProject" >
<Pattern rule="masterList__c" />
<Pattern rule="masterSubList__c" />
<Pattern rule="cookieJar__c" />
</SalesforceTableFamily>Yes
The subject line used for notification emails. Though it can be any text you want, there are a few special text values that will be replaced dynamically before a message is sent:
“{status}” will be replaced by “OK” or “ERROR” based on the outcome of the job.
If there are any exceptions encountered then “ERROR” will be substituted, otherwise “OK” will be used.
“{application}” will be replaced by “CopyStorm/Restore”.
Send Notification On
No
Determines when CopyStorm/Restore will send a notification email:
Success: If checked, an email will be sent if a job works perfectly (no exceptions).
Exception(s): If checked, an email will be sent if a job has any exception (including non-fatal exceptions where CopyStorm/Restore recovered).
Require Encryption
No
If checked, CopyStorm/Restore will require that connections to the email server be encrypted with TLS.
Email User
No
Username used to authenticate with the SMTP server.
Email Password
No
Password used to authenticate with the SMTP server.
Yes
The subject line used for notification emails. Though it can be any text you want, there are a few special text values that will be replaced dynamically before a message is sent:
“{status}” will be replaced by “OK” or “ERROR” based on the outcome of the job.
If there are any exceptions encountered then “ERROR” will be substituted, otherwise “OK” will be used.
“{application}” will be replaced by “CopyStorm/Restore”.
“{file}” will be replaced by the base name of the CopyStorm/Restore configuration file used by the job.
For example, the configuration file “C:\capstorm\config\myCopyStormRestoreConfig.copyStormRestore” will be replaced with “myCopyStormRestoreConfig.copyStormRestore”.
Send Notification On
No
Determines when CopyStorm/Restore will send a notification email:
Success: If checked, an email will be sent if a job works perfectly (no exceptions).
Exception(s): If checked, an email will be sent if a job has any exception (including non-fatal exceptions where CopyStorm/Restore recovered).
Notify Current User
No
If checked, the Salesforce User specified on the Main tab of CopyStorm/Restore will be notified in addition to the specified recipients (Send Email To).
Email Host
Yes
The SMTP host used by your organization (used to send email). If you do not know this information ask your email administrator.
Email From
Yes
The email address that will appear in the “From” field in sent notifications. Note that many email servers allow this value to be a fake email address (e.g. “noreply@capstorm.com”).
Send Email To
Yes
Notification emails will be sent to this white space separated list of email addresses.


Subject
CopyStorm/Restore has the ability to transform data in the CopyStorm backup database prior to writing it to the target Salesforce. Built-in data transformers include:
Scramble — replace each letter with a different letter, replace each number with a different number.
Email Scrambler — build a new email address of the same size but with random letters & digits.
Email Append Invalid — append “.invalid” to an email address.
Asterisk — replace the source data with “******”.
Random Dictionary Substitution — for Names, Countries, Cities, Streets…etc
Lorem Ipsum — replace a block of text to the infamous “Lorem ipsum dolor sit amet, consectetur adipiscing…”
Random Date/Time — replace a date or date/time with a random date or date/time within the same year.
Read more about built-in transformers in the
If the built-in transformers are insufficient for your needs the instructions in this article can be used to add a new transformer to CopyStorm/Restore. The approach described in this article is the same as what CopyStorm/Restore does internally.
To add a dictionary transformer that substitutes values from a provided list of values, you can create or update update the TransformerRegistry.xml file with a tag:
<Transformers> <Dictionary name=”My Transformer Name” file=”/path/to/a/file.txt”/>
This will add two new transformers:
Random: My Transformer Name
Uniform: My Transformer Name
These transformers will replace the input text with a value taken from the text file (one value per line). The Random transformer will replace each input value with a random line from the text file. The Uniform transformer will replace each input value with a line from the text file, always replacing the same input text with the same value from the text file.
The first step is to build a Java class implementing “com.capstorm.copystormrestore.transform.ITransformer”. The code below contains the implementation of the Asterisk transformer:
The parameters to the transform() method are:
The method must return the value to insert / update in Salesforce.
Once the class has been created, package it into a jar and put the jar into the “lib” subdirectory of the CopyStorm/Restore installation. CopyStorm/Restore will only find your class if it is installed in this directory.
For CopyStorm/Restore to discover a field transform it must be declared in a file named “TransformerRegistry.xml” and placed into a directory where CopyStorm/Restore looks for configuration files (for example, the “config” sub-directory of the CopyStormRestore installation).
The TransformerRegistry.xml file should look like the following:
Where:
“name” is the value that will appear in the CopyStorm/Restore GUI.
“class” is the full path to the class built in the first step.
To set up a build and test environment for a new transformer in Eclipse:
Create a new Java project.
Update the new project’s path to reference all jar files in the “lib” sub-directory of CopyStorm/Restore.
For other development environments, including building and testing on the command line, make sure that all the required Jars are on your Java class path.
If this is to much for your team send an email to and they will be happy to arrange a small service contract.
Parameters that determine the underlying database CopyStorm/Restore will use as its Tracker Database. This database allows CopyStorm/Restore to continue a restore if interrupted, and allows .
For example, the configuration file “C:\capstorm\config\myCopyStormRestoreConfig.copyStormRestore” will be replaced with “myCopyStormRestoreConfig.copyStormRestore”.
table
The name of the table containing the column to transform.
column
The name of the column to transform.
columnWidth
The maximum width of the column value.
recordId
The Salesforce Id of the record being processed.
value
The current value of the column. This may be null.
public class AsteriskTransformer implements ITransformer {
@Override
public String transform(String table, String column, int columnWidth, String recordId, String value) {
if( StringUtils.isBlank(value)) { return value; }
return StringUtils.repeat("*", value.length());
}
}<Transformers>
<Transformer name="Asterisk" class="com.capstorm.copystormrestore.transform.AsteriskTransformer" />
</Transformers>H2 (Default)
PostgreSQL
MySQL
Snowflake
SQL Server
Oracle
Tracker Database Name
By default CopyStorm/Restore will pick a tracker name unique to the current configuration file, but it can be explicitly set using this global parameter. Note: CopyStorm/Restore tracking databases are, by default, kept in the directory “$HOME/.capstorm/copyStormRestoreSets”.
Use H2 in Server Mode
When checked, allows the H2 Tracker Database to operate in server mode, enabling support for multiple simultaneous connections.
Parameter
Description
Connection String
A PostgreSQL connection string for connecting to the tracker database.
Connection String Builder
Clicking on this button launches a dialog menu that helps create a valid connection string.
Username
Database username.
Password
Database password.
Schema (optional)
The Database Schema where CopyStorm will house the Tracker data. If left blank, defaults to “PUBLIC”
Parameter
Description
Connection String
A MySQL connection string for connecting to the tracker database.
Connection String Builder
Clicking on this button launches a dialog that helps create a valid connection string.
Username
Database username.
Password
Database password.
Parameter
Description
Connection String
A Snowflake connection string for connecting to the tracker database.
Connection String Builder
Clicking on this button launches a dialog that helps create a valid connection string. More information on the Snowflake Connection String Builder can be found on the .
Username
Database username.
Password
Database password.
Schema (optional)
The Database Schema where CopyStorm will house the Tracker data. If left blank, defaults to “PUBLIC”.
Parameter
Description
Connection String
A SQL Server connection string for connecting to the tracker database.
Connection String Builder
Clicking on this button launches a dialog menu that helps create a valid connection string.
Username
Database username.
Password
Database password.
Parameter
Description
Connection String
An Oracle connection string for connecting to the tracker database.
Connection String Builder
Clicking on this button launches a dialog menu that helps create a valid connection string.
Username
Database username.
Password
Database password.
Schema (optional)
The Database Schema where CopyStorm will house the Tracker data. If left blank, defaults to “PUBLIC”.


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 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.
The “Which Records” option provides a large number of techniques for determining what records to restore. The techniques include:
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 updates are allowed unless a required field is excluded. When a required field is excluded then Inserts are automatically disallowed.
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).
The following two images illustrate the “External Id” and “Multi-Column” record matching policies
Other parameters in the top section are less common to be set by a user. They include:
The “All” option will restore all records in the CopyStorm backup to the Salesforce instance:
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: .
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. It is OK for the Id to match multiple records. 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).
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 that can be pasted into the box.
Any Salesforce Id type column or text column may be chosen to use as the “id” field.
Note: For real Salesforce Ids use a 15 or 18 character id.
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:
Click on “Click Here To Edit”.
See this page for more information on configuring a record filter in CopyStorm/Restore: .
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
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.
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.
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
The “SOQL” option will restore all records whose id matches the value returned by a user supplied SOQL statement.
For example,
To select a Contact record by name:
SELECT id FROM Contact WHERE Name='Michael Jordan'
To select Contacts with closed support cases:
SELECT contactId FROM Case2 WHERE isClosed=1
Write SQL against the CopyStorm database to determine which records to restore. This technique is for advanced developer types.
Write SOQL against the target Salesforce instance 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.
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.
For documentation on using a record filter with CopyStorm/Restore, see the page: Limiting Records To Restore With a Record Filter.
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 closed 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 (<>)
Restore all records from the CopyStorm backup.
Use a rich GUI to create a filter limiting which records are restored.
Provide a file of Ids listing the records to restore. The “ids” can be any Salesforce “Id” or “String” type column.
Paste in a list of Ids listing the records to restore. The “ids” can be any Salesforce “Id” or “String” type column.
Restore a random number of records, optionally using a filter to control which records can be selected.
Only restore records which are referenced by another table.
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.
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
When enabled, CopyStorm/Restore will avoid the check to see if a record is already in the target Salesforce. Note that when “Skip Record Id Check” and “Skip Original Id Check” are both enabled, all operations will be Inserts.
Skip Original Id Check
When enabled, CopyStorm/Restore will avoid the check to see if a record has already been restored to the target Salesforce by checking the “Original Id” column. Note that when “Skip Original Id Check” and “Skip Record Id Check” are both enabled, all operations will be Inserts. Note that this option will only be displayed if the “Original Record Id” Migration feature is enabled.











CopyStorm/Restore is generally used in GUI mode, but it is possible to run Copystorm/Restore as a command line application. This is useful for repetitive tasks such as:
Refreshing 15 training Salesforce sandboxes in preparation for the next training class.
Prerequisites:
A CopyStorm/Restore configuration file. This is the file saved by the GUI when selecting File -> Save As.
The simplest form of a CopyStorm/Restore command line is:
Windows:
CopyStormRestore.bat -run myConfig.copyStormRestore
Linux / Mac:
sh CopyStormRestore.sh -run myConfig.copyStormRestore
When running in command line mode CopyStorm/Restore will write progress and any errors encountered to stdout, in addition to the Tracker Database.
Often when CopyStorm/Restore is run in batch mode any history about past restores stored in the Tracker Database should be forgotten. The script that launches CopyStorm could delete the existing Tracker Database — and if so, Copystorm/Restore will automatically recreate it. However, a simpler solution is to use the -restart command-line switch. When the -restart switch is present, Copystorm/Restore will reset the Tracker Database before the restore begins. For example,
Windows
CopyStormRestore.bat -restart -run myConfig.copyStormRestore
Linux / Mac:
sh CopyStormRestore.sh -restart -run myConfig.copyStormRestore
-restart
Reset the CopyStorm/Restore tracker database before starting the restore.
This will delete all historical data in CopyStorm/Restore. Ids restored in previous jobs will no longer be available.
-scan
Run a candidate scan before starting the restore.
This will search the CopyStorm database for any new records matching the Restore Set prior to starting the restore.
-resetSkippedReasons
Clear record skipped reasons before starting the restore.
This will delete all historical record skip reasons from the CopyStorm/Restore tracker database prior to starting the restore.
-deleteExceptions
Clear historical exceptions before starting the restore.
This will delete all historical job exceptions from the CopyStorm/Restore tracker database prior to starting the restore.
-scanonly
Run a candidate scan and do not start the restore.
This will search the CopyStorm database for any new records matching the Restore Set and add them to the CopyStorm/Restore tracker database, but will not restore to Salesforce.
-run
Specifies the configuration file used to drive the restore.
-restoreType
Specifies the type restore to perform. Recognized values include:
data (default)
metadata
tracker
data: Restore records to Salesforce, optionally scanning for new records to restore or removing Restore history prior to restoring.
metadata: Restore metadata to Salesforce.
tracker: Do not restore records to Salesforce. Only perform operations which impact the CopyStorm/Restore tracker database without uploading data to Salesforce.
-sftype
The type of Salesforce instance. Recognized values include:
Production
Sandbox
DatabaseDotCom
-sfuser
Salesforce username.
Note that this option can be used to override the Salesforce user name for both the classic and type.
-sfpassword
Salesforce password.
-sftoken
Salesforce security token, if required by your organization.
-sfhost
Salesforce host
If you use a custom domain like capstorm.my.salesforce.com specific it here. For scratch orgs a Salesforce host must always be specified.
-dbuser
CopyStorm database username.
-dbpassword
CopyStorm database password.
-dbconnection
CopyStorm database connection string.
-dbschema
Schema Name
Override (or set) the database schema value in the configuration file.
-proxyHost
Host Name
Override the proxy server in the configuration file. Example: proxy.capstorm.com
-proxyPort
Port Number
Override the port number used by the proxy server.
-proxyUser
Username
Override the username used to authenticate with the proxy server.
-proxyPassword
Password
-apiTraceFile
File Name
Log all communication with Salesforce to a file.
The Restore Plan tab provides insight into the decisions made to determine the order in which CopyStorm/Restore will find restore candidates and the order in which records will be inserted / updated in Salesforce. There are a number of subplans displayed as illustrated in this screenshot:
All plans are an accurate representation of what CopyStorm/Restore does during a restore except for the Candidate Scan Order. The Candidate Scan Order plan is a good representation but the implementation is a bit more complex in order to handle arbitrary direct and indirect circular relationships between tables.
Restore Order — lists the order in which tables will be written to Salesforce.
Candidate Scan Order — lists the order in which candidates for a restore will be found and is based on the rules set up in the Restore Editor tab.
— lists the tables in the order in which they will be restored plus any related tables that are restored later in the plan.
— lists the tables in the order they will be restored plus all table dependencies. This is the best insight into how CopyStorm/Restore selects the order in which to restore tables.
— used to correct dependency relationships when they are incompletely defined in the Salesforce metadata. It is rare for a customer to use this tab.

The Meta Data tab enables the restoration of Salesforce metadata with surgical precision.
This tab is divided into three sections:
The Object Selector — add or remove a metadata object from the deployment set.
The Object Editor — precisely select the properties of a metadata object that should be deployed.
The Object Deployment Tools — deploy the selected metadata.
To add a metadata object to the deployment set, click on the checkbox next to its name. Default behavior will be to load the object into the Object Editor. To remove a metadata object from the deployment set, uncheck the box next to its name.
To narrow a search for metadata objects, use the filter controls above the Object Selector list:
Meta Data Type — if selected, only metadata objects of the given type are displayed. If blank, all metadata types are shown.
Selected — if checked, only metadata object that are part of the deployment set will be shown.
Invert — when clicked, unchecks any checked items and checks all unchecked items.
Clear — when clicked, unchecks all visible checked items.
The Object Editor allows selection of:
The version of the metadata object which will be deployed.
The sub-components of the metadata object which will be deployed.
There are two types of object editors:
Simple — the only available option is the version which will be deployed.
Examples include ApexPage, ApexClass, and PermissionSet.
Complex — there are multiple sub-components that can be selected individually.
An example of this is CustomObject — its sub-components include CustomFields, ValidationRules, etc…
There are several basic object deployment tools:
Deploy — deploys the selected metadata to Salesforce.
Show Plan — displays a summary of metadata in the deployment plan.
Create Deployment Directory — create a directory structure usable by the to deploy the selected metadata.
Create Destruction Directory — create a directory structure usable by the to delete the selected metadata.
Name Filter — as characters are typed into this box, only metadata objects containing the typed text will be displayed.

Migrating data from a Salesforce instance to an unrelated Salesforce instance the mapping between system tables can be complex and mapping rules are needed to control how records in a CopyStorm backup map to records in a target Salesforce.
This article review two types of mapping rules:
Simple column value mapping rules.
Complex mapping rules.
All mapping rules provide a map of Ids in the CopyStorm backup to corresponding Ids in the target Salesforce.
For example:
If a User record in CopyStorm has the same email address as a record in the target Salesforce, map the CopyStorm User.Id to the Salesforce User.Id.
Mapping rules are stored in a configuration file named “DefaultRecordMapRule.xml”, stored in any of the normal places for CopyStorm/Restore configuration files. It contains two types of supported entries:
ColumnBasedBuilder — a mapping rule determining a match between two records based on the value of one or more columns.
FunctionBasedBuilder — a mapping rule determining a match between two records based on user supplied Java code, using any technique to determine if records match.
The built-in DefaultRecordMapRule.xml looks like:
A Simple Column Value Mapping Rule is used when a CopyStorm and Salesforce record should be considered the same if one or more columns in the two records match. For example, the following rule indicates that two User records are the same if the records contain the same email address:
A rule indicating that Record Types match if they are for the same SObject and have the same Name is:
A Function Based Rule uses arbitrary Java code to build an Id mapping between CopyStorm records and Salesforce records. For example:
The built-in Pricebook2 function rule ensures that the standard pricebook in the CopyStorm backup maps to the standard pricebook in the target Salesforce.
The built-in Organization function rule ensures that the Salesforce Org Id in the CopyStorm backup maps to the Org Id of the target Salesforce.
There are two steps required to add a new Function Based Rule to CopyStorm/Restore:
Write a Java class implementing the rule and store the implementation in a jar within the “lib” sub-directory of the CopyStorm/Restore installation.
Add a “FunctionBasedBuilder” XML entry to the “DefaultRecordMapRuleBuilder.xml” file.
For example, this is the function based rule for Organization built into CopyStorm/Restore:
<DefaultRecordMapRuleBuilders>
<!-- Column Based Builders match records based just on the values of one or more columns. -->
<ColumnBasedBuilder tableName="User" columns="Email" />
<ColumnBasedBuilder tableName="Profile" columns="Name" />
<ColumnBasedBuilder tableName="UserRole" columns="Name" />
<ColumnBasedBuilder tableName="Group" columns="Name" />
<ColumnBasedBuilder tableName="RecordType" columns="Name,SObjectType" />
<!-- Function based builders require custom code to build a mapping. -->
<FunctionBasedBuilder tableName="Pricebook2" class="Pricebook2RecordMapRuleBuilder" />
<FunctionBasedBuilder tableName="Organization" class="OrganizationRecordMapRuleBuilder" />
</DefaultRecordMapRuleBuilders><DefaultRecordMapRuleBuilders>
<ColumnBasedBuilder tableName="User" columns="Email" />
</DefaultRecordMapRuleBuilders><DefaultRecordMapRuleBuilders>
<ColumnBasedBuilder tableName="RecordType" columns="Name,SObjectType" />
</DefaultRecordMapRuleBuilders>public class OrganizationRecordMapRuleBuilder extends AbstractDefaultRecordMapBuilder {
private static String ORGANIZATION = "Organization";
/**
* Build a list of rules that map from CopyStorm record ids to ids in the target Salesforce.
*
* @param session -- connection to the target Salesforce.
* @param dataSource -- connection to the source CopyStorm database.
* @returns list of rules mapping CopyStorm ids to Salesforce Ids
*/
@Override public List buildRules(Session session, DataSource dataSource) throws Exception {
CopyForceTableFactory copyForceTableFactory = CopyForceTableFactory.getInstance();
List results = new ArrayList();
//
// If the CopyStorm backup does not include the Organization table then we have no way of determining the original organization id.
//
if( !copyForceTableFactory.isTableDefined(dataSource, ORGANIZATION )) { return new ArrayList(); }
JdbcTemplate jdbcTemplate = new JdbcTemplate( dataSource );
ICopyForceTable csTable = copyForceTableFactory.getTable(dataSource, ORGANIZATION );
List csOrgs = jdbcTemplate.queryForList( "SELECT Id FROM " + csTable.getCopyForceName() , String.class );
if( 1 != csOrgs.size()) { return results; }
RecordMapRule rule = new RecordMapRule(ORGANIZATION, "Id");
rule.getValueMap().put(csOrgs.get(0), session.getUserInfo().getOrganizationId());
results.add(rule);
return results;
}
}The Restore Set Editor tab is used to select which tables and fields will be restored to Salesforce. The editor is divided into two major sections:
The Table Selector
The Table Editor
The section on the left, the Table Selector, indicates which table(s) have been selected for the restore.
Tables that have been selected to be restored will always be displayed.
Tables that have not been selected will appear only if their name matches the filter criteria under the “Select” drop-down located in the top of the selector.
If a table name is followed by a red (ref), only records referenced by other tables in the list will be restored.
If a table is selected but no longer in Salesforce its name will be followed by a red [Not in Salesforce].
The section on the right, the Table Editor, is used to control the restore parameters for the selected table on the left. In the following screen shot a table has not yet been selected. Click on a table name to display its Restore Rule.
The Table Editor on the right-hand side of the Restore Set Editor tab controls restore parameters for individual tables. It is divided into 4 or 5 tabs.
The “Select Records” tab controls:
Which specific records will be restored to Salesforce.
Whether Inserting, Updating, or both operations should be allowed.
The “Reference Fields” tab controls what should happen when a table’s reference fields are pointing to records not in the target Salesforce and not part of the restore. For example, when restoring an Account with a Parent Account should the Parent Account be automatically restored.
Available options include “Restore Referenced Record” and “Skip Record”.
The “Fields” tab supports fine control over which fields will be restored AND field level masking and obfuscation. By default all fields are restored.
The “Related Lists” tab supports including records in child tables, grandchildren, great-grand children, etc. (to any depth) in the set of records to restore. Example: With a couple of mouse clicks CopyStorm/Restore can be told to restore all child, grandchild, etc. tables for selected Accounts.


The Restore tab is used to launch a restore operation and view progress. This tab allows several operations:
Estimate the size of a restore.
Run a restore for the first time.
Resume a restore from the point at which it last stopped.
Restart a restore, ignoring any saved history from previous restores.
View errors and exceptions that occurred during a restore.
The first time a restore is set up for a Salesforce instance the restore tab will look like the following:
The “Estimate Size” button will scan the CopyStorm database and estimate the number of records that will be restored to Salesforce. The estimate is the maximum number of records to be restored.
The “Start Restore” button will restore data to the Salesforce instance. If an “Estimate Size” operation has not been performed, the first thing a “Start Restore” will do is to estimate the size.
If the restore rules specify a RANDOM number of records and no seed is supplied, each time Estimate Size or Start Restore buttons are clicked a new set of randomly selected candidates will be chosen. This process is additive and will result in restoring more than the random limit supplied on the Restore Set Editor tab. Entering a seed value will eliminate this potential problem and allow size estimation before starting a restore. This is most commonly used when restoring a development sandbox to exactly the same state every time.
While a restore is running, the table displayed on this tab will change dynamically with information about the restore progress. The “Cancel” button can be used to stop a restore at any point.
After the restore has finished the Restore tab will expose several new buttons below the progress grid:
The “Re-scan Candidates” button will reevaluate the table record selection rule and look for new restoration candidates. New candidates may be found if the record selection rule for any table has changed, or if subsequent CopyStorm jobs have added new data to the backup.
The “Estimate MBytes” button will estimate the number of megabytes to be written to Salesforce, using Salesforce’s estimation algorithm.
The “Continue Restore” button will continue a restore from the place where it last stopped, optionally ignoring previous restore history and restarting the restore from scratch.
Be careful about restarting a restore — any record inserted during a previous restore will be inserted again (with a different Salesforce ID).
To resume a restore, click on the “Continue Restore” button. The provides the ability to resume a partially completed restore or to delete restore history and restart a restore from the beginning.
If the restore operation encounters any error(s) an “Exceptions” button will appear on the Restore tab:
Click on the “Exceptions” button to see the details. The exception displayed in the screenshot below was caused by an email address in the CopyStorm backup which did not pass Salesforce validations rules in the target Salesforce. You may see similar problems in your data if schema changes or validation rule changes have made historical data invalid.
CopyStorm/Restore includes a series of columns for each table that is restored. These columns include:
# Ref Updates
The number of records that required a second pass to restore reference fields that could not be set on the first insert or update operations. A common example of this is when a child Account is restored before its parent Account. A second pass is required to set the child’s parentId field.
# Restored
The total number of records that were restored.
# Skipped
The total number of records that were skipped.
# Errors
The number of errors reported while attempting to restore records of this type.
Start Time
The time that the restore for this table started.
Elapsed Time
The total amount of time spent restoring this table.
Stage
The current restore stage for a table can be one of:
Waiting — no processing has taken place.
CandidateScan — scanning the restore rules looking for candidate records.
CandidateLoopScan — looking for recursion in the data that adds additional candidate records.
CandidatesReady — all restore candidates have been found.
Restore — inserting / updating records in Salesforce.
RestoreReferences — restoring reference fields that could not be restored in the previous step.
Finished — done restoring to this table.
Table Name
The name of the table being restored.
# Candidates
The total number of potential records to be restored.
# Inserts
The number of records restored by inserting a new record into Salesforce.
# Updates




The number of records restored by overwriting the content of existing records in Salesforce.
The Advanced Tab supports control of what Salesforce triggers, validation rules, flows, workflows, and restricted picklists are temporarily disabled during a restore. Note than any item disabled by CopyStorm/Restore will automatically be re-enabled when a restore completes or is cancelled.
Why are these features necessary? Let’s look at a few examples:
There is a Salesforce trigger that initiates notifications for Opportunities larger than $50,000. During a restore running this trigger would be a bad idea.
Validation rules have changed over time and much historical data will not pass the current rules. Disable the rules during a restore.
Control of the following item types is supported:
Configure the scope of automation management to include Rules and Workflows from Managed Packages.
Configure the timing of automation re-enablement.
Disabling triggers during a restore is a common necessity. For example, if an Opportunity trigger sends an email on large opportunity creation you will want to avoid this when restoring to a sandbox. Another common problem is triggers which are not designed to handle large blocks of records and when they receive a large block they exceed the Apex statement limit per transaction.
When a trigger is added using the Edit Trigger Selection button, CopyStorm/Restore will disable the trigger at the beginning of the restore process and re-enable it after the restore completes or is cancelled. Note that on a sandbox the disablement/enablement of triggers is relatively fast, but on a production environment changing the enablement status of a trigger will cause unit tests to run.
Disabling validation rules during a restore is a common process because older data will often not pass the current validation rules.
In most cases, letting CopyStorm/Restore manage validation rule disablement/enablement is sufficient. When this option is enabled:
CopyStorm/Restore disables active validation rules for a table just before data is written to the table.
Once updates/inserts to a table are complete, CopyStorm/Restore re-enables the validation rules it disabled in the previous step.
If updates to one table cause updates in another table (for example: an OpportunityLineItem change can cause an update to the Opportunity table) then it may be necessary to explicitly choose validation rules to disable. If a rule is explicitly selected then the rule will be disabled at the beginning of the restore process and re-enabled when the restore process completes or is cancelled.
If automatic management is enabled and a validation rule appears in the explicit list then the automatic management system will ignore the rule.
Disabling ProcessBuilder/Flows during a restore is a common necessity to avoid processing. For example, if an Opportunity flow sends an email on large opportunity creation you will want to avoid this when restoring to a sandbox.
When a Flow is added using the Edit Flow Selection button, CopyStorm/Restore will disable the Flow at the beginning of the restore process and re-enable it after the restore completes or is cancelled.
When a Flow is selected, the current version of the Flow is displayed. When CopyStorm/Restore disables the flow as part of the restore process, it will query Salesforce for the current active version – and disable the active version (and re-enable the disabled version when the restore is finished).
Disabling workflow rules during a restore is a common process to avoid a process that normally happens when a user enters/modifies a record via the GUI.
In most cases, letting CopyStorm/Restore manage workflow rule disablement/enablement is sufficient. When this option is enabled:
CopyStorm/Restore disables active workflow rules for a table just before data is written to the table.
Once updates/inserts to a table are complete, CopyStorm/Restore re-enables the workflow rules it disabled in the previous step.
If automatic management is enabled and a workflow rule appears in the explicit list then the automatic management system will ignore the rule.
Disabling restricted picklists during a restore is a common process to avoid encountering errors with older records whose values do not meet the criteria of the current picklist definition.
In most cases, letting CopyStorm/Restore manage restricted picklist disablement/enablement is sufficient. When this option is enabled:
CopyStorm/Restore disables active restricted picklists for a table just before data is written to the table.
Once updates/inserts to a table are complete, CopyStorm/Restore re-enables the restricted picklists it disabled in the previous step.
If automatic management is enabled and a restricted picklist appears in the explicit list then the automatic management system will ignore the rule.
Note that this element will not disabled a Global Picklist (a picklist defined outside of the confines of a specific table).
Disabling Duplicate Detection rules during a restore is a common practice needed to restore older data whose values do not meet current duplicate rule criteria.
In most cases, letting CopyStorm/Restore managed duplicate detection rule disablement/enablement is sufficient. When this option is enabled:
CopyStorm/Restore disables active Duplicate Detection rules for a table just before data is written to the table.
Once updates/inserts to a table are complete, CopyStorm re-enables disabled Duplicate Detection rules.
Disabling Required Field rules during a restore is a common practice needed to restore older data that may not have a value for a new field or a field that was not historically required.
In most cases, letting CopyStorm/Restore managed required field disablement/enablement is sufficient. When this option is enabled:
CopyStorm/Restore disables the “Required” option for a field just before data is written to the field’s table.
Once updates/inserts to a table are complete, CopyStorm re-enables disabled “Required” options.
Disabling Lookup Filters during a restore is a common practice needed to restore older data that may not have reference fields that match current Lookup Filter validations.
In most cases, letting CopyStorm/Restore managed lookup filter disablement/enablement is sufficient. When this option is enabled:
CopyStorm/Restore disables the Lookup Filter rules for a field just before data is written to the field’s table.
Once updates/inserts to a table are complete, CopyStorm re-enables disabled Lookup Filter options.
CopyStorm/Restore supports saving a restore set configuration in two formats:
Plain-text XML.
Encrypted text using 256-bit DES encryption.
Both formats allow saving Salesforce and database credentials — passwords are always encrypted. A CopyStorm/Restore session can be completely restored using the File / Open operation.
The “Save” dialog allows the selection of a directory and file name, as well as options to Encrypt and Save Passwords:
The plain-text XML version of the file is not intended to be edited by hand, as it is fairly complex. If problems arise from hand-editing a configuration file, Capstorm may not supply support.
Contains common recipes for the restoration of Salesforce data using CopyStorm/Restore. Included are a basic sandbox recipe, restoring Accounts with largest Opportunities, and restore Accounts limiting the number of Cases per Account. A discussion of issues surrounding a complete restore and recipe of a complete restore is also included.
Provides information essential to understanding how CopyStorm/Restore restores records and complex relationships to a Salesforce database.
Describes the internal structure and types of data stored in the CopyStorm/Restore Tracker Database.
For most Salesforce metadata objects there are two restore type options.
Complete: Restore the a complete backup of the object to Salesforce.
Expert: Modify the raw definition of the object manually before deploying to Salesforce.
All CopyStorm/Restore simple editors look and behave similar to the ApexPage example below. Note that the only modifiable parameter is the version.
Switching the restore type to Expert will change the display to the Expert Mode Editor. For additional help see the page.













CopyStorm/Restore’s Advanced Metadata Selector provides a way to identify Metadata that has been modified at a particular point in time. After selecting the point in time, CopyStorm/Restore will automatically identify the metadata items that were modified during the provided window.
The following dialog will appear:
Provided Parameters:
Start Date (Optional): Metadata changes made after this date will be added to the Restore Set.
End Date (Optional): Metadata changes made before this date will be added to the Restore Set.
Selection Strategy
Most Recent
Use the most recent change between the Start / End dates.
Earliest
Selection Rules
Full Metadata Restore
If checked, CopyStorm/Restore will configure all newly selected metadata items to be fully restored.
If unchecked, CopyStorm/Restore will use the currently selected default.
Clicking on the Restore Tab’s “Continue Restore” button will display a dialog to configure parameters for the restore operation:
Clicking on the “Start Operation” button will cause CopyStorm/Restore to upload all Pending records from the Tracker Database into Salesforce – either resuming a previously cancelled restore job or augmenting a previous restore with all new candidates in the Tracker Database.
If any record(s) are being retried via the Tracker Database’s “Set to Pending” feature, their historical skip reason and exception information will be removed from the tracker prior to the restoration reattempt (if they fail to restore a second time, the most recent skip reason and exception will be recorded).
To delete the history of previously restore records and restart the restore from the beginning, update the “Reset Restore” dropdown:
Do Not Reset – keep all Restore history.
Reset Exception History – delete Exception logs before restoring records.
Reset Restore History – delete all restore history and record maps before re-scanning for candidates and restarting the Restore.
To try to insert / update records that previously failed to Restore, check the “Retry Failures” checkbox. If this checkbox is checked:
Mark all “Skipped” records in the Tracker as “Pending”.
Try to Insert or Update all records that were changed from “Skipped” to “Pending”.
To limit the tables that CopyStorm/Restore will push to Salesforce, check the “Select Specific Table Rules to Include” checkbox. If this checkbox is:
Unchecked, all pending candidates will be restored.
Checked, only pending candidates from the selected tables will be restored.
Checking the “Select Specific Table Rules to Include” checkbox will display a table selector, allowing specific tables to be selected as candidates for restoration:
Repair Reference Fields
This option will cause CopyStorm/Restore to update previously restored records with the latest Id mappings from the Tracker Database and Migration tabs.
This option should be used when performing incremental restores using the “Select Specific Table Rules to Include” option.
Ignore Advanced Tab Rules
The Deploy action (button) launches a dialog for initiating and monitoring a deployment to Salesforce. Deployments consist of three stages:
Review/update the options controlling the deployment.
Review the deployment plan.
Run the deployment.
Generally the only step a user needs to do is click on the “Deploy” button.
The Deployment Options tab controls how the deployment is executed.
The Deploy Plan tab lists a summary of all metadata objects that will be deployed. This is used as a final review prior to launching the deployment.
The Deploy Log tab shows the progress of the deployment as it happens and provides a way to cancel an active deployment.
During a deployment this tab may look like the following:
When the deployment is complete the log tab will show the final status of the deployment:
Salesforce records often contain references to other records. For example:
Contact records contain a reference to an Account in their AccountId field.
Nearly all records contain a reference to the Salesforce user who owns the record in an OwnerId field.
The Reference Fields portion of the Restore Set Editor defines the action which should be taken if a record references another record that is neither:
Already in Salesforce.
Restored by another table rule.
This editor contains three columns for each reference field:
A checkbox which determines whether or not the reference field should be restored.
If not checked the field will not be modified on an UPDATE and will take the default value on an INSERT.
The name of the reference field with a superscript indicating the Salesforce table to which it refers.
The action to take if the value of the reference field in CopyStorm points to a record not present in the target Salesforce.
The following screen shot lists the reference fields for the Account table in a default Salesforce instance:
For all reference fields EXCEPT those referencing the Salesforce User table, the following options will be available:
Reference field linking to the Salesforce User table have a different set of options. Common reference fields of this type include “OwnerId”, “CreatedById”, and “LastModifiedById”.
Salesforce User references are treated differently because Salesforce will not permit a record to be created with an owner that is an inactive Salesforce User.
The “Related Lists” editor determines which records from related lists will be restored for each record. For example, when restoring Account the related lists Contacts, Cases, and Opportunities will usually be available.
To restore a related list click on the check box next to the name.
In the following screen shot the related lists Assets, Cases, Contacts, and Opportunities were selected for the Account table. This will cause CopyStorm/Restore to restore all Asset, Case, Contact, and Opportunity records related to selected Account records. Note that the superscript on each related list indicates the SalesForce Table and Column associated with the list.
Related lists can be selected to any level. Example: Account->Contact->Attachments.
As related lists are selected, they will automatically be marked as checked in the master table list on the left.
The control buttons at the top are often quite important and can be used to:
Expand/Collapse the tree of related lists.
Select all related lists (direct, grandchildren, great-grandchildren, .etc.) to any level.
Deselect all related lists.
In the following screen shot, the account named Capstorm, LLC and all of its related lists were selected for a restore. The steps were:
Set the Account filter to select just the Capstorm, LLC company.
Click on the Select All button for related lists.
Are you curious about how many tables were actually selected? The answer is 60!
When restoring test datasets to developer sandboxes or other environments with limited data capacity, it can be useful to limit the total number of records that will be restored either in:
Any single related list under any single record – for example, to ensure that no single Account will have more than the specified number of Contacts.
A single table, regardless of how many related records are in the CopyStorm database, will be limited to the specified number of records.
In practice, it is unusual to restore absolutely every related list for a record because certain system tables are best excluded (since they are already populated). When the Select All button is clicked, checking the “Include System Tables” checkbox will give you the option of restore none, a few, or all related system tables.
Advanced parameters for controlling how data is written to Salesforce.
Default Max # Per Update
The maximum number of records that will be sent to Salesforce in a single batch. The default value for this parameter rarely needs to be changed.
# Salesforce Writers
The maximum number of insert/update requests that CopyStorm/Restore will make at the same time. The default value, 1, will write up to 200 records at a time using a single request. The maximum value, 10, will write up to 2000 records at a time using 10 concurrent requests. Higher values cause CopyStorm/Restore to consume more memory but can reduce total copy time by a factor of 2-10x. Observed performance increases depend on a number of factors including active triggers and validation rules.
Allow Nulls
If checked, fields with a value of null will be restored (potentially destructive).
A CopyStorm/Restore Tracker Database can be opened, viewed, and manipulated independently of CopyStorm/Restore using the H2 Console. The H2 Console is a web based tool built into the H2 which supports all of the regular SQL commands associated with any relational database. The launch script for the H2 Console is located in the same directory as CopyStorm/Restore and called:
h2console.bat (windows)
sh h2console.sh (Linux and Mac)
Note: IT IS IMPORTANT to start the H2 Console using this script if you intend to modify a tracker database using SQL. Otherwise your modifications will failed because required database triggers will not be found (the triggers are implemented in Java and loaded using the h2console command provided by Capstorm).
There are several key things to understand before launching the H2 Console.
If your tracker database is named MyTracker123 (on the CopyStorm/Restore General Parameters tab) then the H2 path to your tracker database is:
jdbc:h2:~/.capstorm/copyStormRestoreSets/MyTracker123
The default user name for a tracker database is: root
The following screen shots show the sequence of logging into a H2 database and running a query.
Once H2 credentials are entered, click on the Connect button to login and launch the H2 query tool.
For additional help see:
The main CopyStorm/Restore tab is used to manage credentials for Salesforce and the source CopyStorm database.
Default settings that globally impact data operations when uploading data or configuring CopyStorm/Restore.
Clicking on the Restore Tab’s “Re-scan Candidates” button will display a dialog to configure parameters for the re-scan operation:
Pressing the “Start Operation” button will cause CopyStorm/Restore to identify any new records in the CopyStorm database that match the current configuration in the Restore Set Editor. All records that are identified will be added to the Tracker Database – allowing them to be restored by CopyStorm/Restore.
The default settings in this popup will cause all tables, records, and relationships to be rescanned. This will ensure that any changes in the CopyStorm database or Restore Set Editor are reflected in the Tracker Database.
There are three checkboxes that can be used to limit the amount of data scanned:
Rescan All Record Relationship Dependencies (if false, only new records are scanned)
Set to Null
If the referenced record is not already in Salesforce then set the reference field to null.
Skip Record
If the referenced record is not already in Salesforce then do not restore the record.
Create Record
If necessary, create the referenced record in Salesforce.
Use Default
If the referenced User record is missing or is an inactive Salesforce User then use the Salesforce User specified as the default User on the “Global Parameters” tab.
Skip Record
If the referenced User record is missing or is an inactive Salesforce User then do not restore the record.








capstormCopyStorm/Restore cannot be using your tracker database at the same time as the H2 Console.


Include Overflow Snapshot
If checked, CopyStorm/Restore database queries will include records in the Default Record Overflow snapshot. This snapshot contains records that cannot be written to the primary CopyStorm database due to row size constraints.
Default Salesforce User
The Salesforce User to use as the record owner if the owner in the CopyStorm database is not active or does not exist in Salesforce. A value of “Default” will cause the Salesforce user running CopyStorm/Restore to be used. The pull-down menu contains all active users in the Salesforce instance.
Default Restore Type
When a table is added to the restore, default behavior will be to use this type of restore:
Insert
Update
Full Metadata Object Restore by Default
If unchecked, the default procedure for restoring a complex metadata object is to support partial definition restoration rather than the entire definition.

Keep Existing Selections
If checked, CopyStorm/Restore will keep currently selected Metadata in the Restore Set.
If unchecked, CopyStorm/Restore remove all currently selected Metadata from the Restore Set, then repopulate the Restore Set based off of the provided parameters.


This option will cause CopyStorm/Restore to not use the rules specified on the Advanced Tab.
When checked, CopyStorm/Restore will not automatically disable triggers, validation rules, workflows, etc… when restoring data.








Alternate Host
If your connection to Salesforce does not use one of the standard endpoint (login.salesforce.com or test.salesforce.com) then you must specify your endpoint as an alternate host. If an Alternate Host is not provided, the standard endpoint for the “Instance Type” that is selected will be used.
Example:
capstorm.my.salesforce.com
Advanced Parameters
Use the Advanced Parameters dialog to set proxy information , timeout limits, and other communication details.
Parameter
Description
Connection String
JDBC connection string required to use a CopyStorm database.
Connection String Builder
Clicking on this button launches a dialog that helps create a valid connection string.
Username
CopyStorm database username.
Password
CopyStorm database password.
Schema
Default schema to use. Note that this parameter is not supported by all databases.
Parameter
Description
Credential Type
This indicates how Salesforce credentials are managed. Built-in options include:
Username And Password (default).
One-Time Password Authenticator
Changing this parameter will cause the GUI for the Salesforce credentials to adapt.
Salesforce Batch Size
Maximum number of records to read from Salesforce in a single API call. The default, 2000, should rarely be changed.
Max Timeout
Maximum number of seconds to wait for a response from Salesforce. This should rarely be changed.
Describe Batch Size
Number of table definitions to read from Salesforce in a single batch. This should rarely be changed.
Apache/HttpClient
If checked then Apache’s HttpClient will be used to communicate with Salesforce rather than the default client built into the library. This option should not be checked when the standard library works.
After entering parameters for a connection, a “Test Connection” button will become enabled and can be used to validate the credentials.
Parameter
Description
Instance Type
Type of Salesforce instance being copied.
Production
Sandbox
Database.com
This is required when the “Alternate Host” is empty.
Username
A Salesforce user. This user must have API privileges. All data visible to this user will be copied to the CapStorm database.
Password
The password for the Salesforce user.
Security Token
Optional security token supplied by Salesforce.
If this checkbox is unchecked, only newly identified records’ related list and reference field rules will be scanned.
Mark Updates as Pending (if false, only new records will be marked as pending)
If this checkbox is checked, both new records and records that have been updated in the CopyStorm database will be set to Pending in the CopyStorm/Restore Tracker (and subsequently inserted or updated in Salesforce).
If this checkbox is unchecked, only new records will be set to Pending in the CopyStorm/Restore Tracker.
Select Specific Table Rules to Include (by default all are included)
If this checkbox is checked, CopyStorm/Restore will only scan for new records in the indicated tables.
If this checkbox is unchecked, CopyStorm/Restore will scan for new records in all tables configured in the Restore Set Editor tab.
If the Select Specific Table Rules to Include checkbox is checked, a table selector will appear to allow specific table selection:

There are a number of occasions that require table specific processing rules. This section describes how to augment the built-in table specific processing rules in CopyStorm/Restore.
The most common case requiring a table specific rule is a need to limit the number of records sent to Salesforce in a single batch. The default value, 200, may be too large for specific tables because of complex INSERT / UPDATE triggers causing the “Too Many DML Statements” error to be thrown by Salesforce.
CopyStorm/Restore supports overriding or extending the default table processing rules by editing a file named “TableRuleRegistry.xml” in a subdirectory “config” of the root CopyStorm/Restore directory. By default, CopyStorm/Restore includes a template TableRuleRegistry.xml with a large block comment explaining usage.
Several common overrides are included below.
The following sample TableRuleRegistry.xml file will cause CopyStorm/Restore to limit all writes to Salesforce to ten or fewer records:
The following sample TableRuleRegistry.xml file will cause CopyStorm/Restore to limit all inserts / updates to the Case table to five or fewer records.
Use Describe Cache
If checked then Salesforce table definitions will be kept in a disk cache rather than in memory. This should rarely be checked.
Proxy Host
Optional name or IP address of a proxy host. Leave this blank if a proxy is not being used.
Proxy Port
Optional port on which a proxy server is listening.
Proxy User
Optional username when required by a proxy server.
Proxy Password
Optional password when required by a proxy server.



<TableRules>
<TableRule name="default" restoreBatchSize="20" />
</TableRules><TableRules>
<TableRule name="Case" restoreBatchSize="5" />
</TableRules>Each time CopyStorm, CopyStorm/Restore, or CopyStorm/Medic runs, it records job information and statistics into a set of history logging tables within the CopyStorm database. The History Tab supports viewing and exporting CopyStorm job history.
The History Tab consists of two sections — a top section used to search for past CopyStorm jobs and a bottom section displaying a one-line status for each job in the database.
When the “View…” column is clicked from the History tab, a dialog appears providing detailed job status. This dialog will open with the Overview tab which displays a list of the tables present in the restore set with metrics for the records that were restored, skipped, or encountered exceptions within each table.
By clicking the “View…” link in the left-most column for any given table in the Overview list, you can view more detailed information about the restore operations carried out on the records within that table.
See below for example using the “Account” table.
Any exceptions that occurred during the job will be displayed in the Exceptions tab. In the following example, the job had six exceptions. Each exception can be selected to view the full stack trace to assist with troubleshooting.
If any records from the CopyStorm Database are “skipped” and not uploaded to Salesforce during a restore job, the “Skipped Reasons” tab will display each instance of skipped records, and the reason why they are skipped. Below is an example of several records being skipped for various reasons.
CopyStorm/Restore jobs support the temporary disabling of Saleforce Automation Flows during the restore process according to the user specified configuration. (For more info on configuring this behavior, see .) Logs of any temporarily disabled Salesforce Automations, as well as the re-enabling of such Automations can be viewed here. See below for example.
Performance metrics for each restore job can be viewed under the “Performance Logs” tab. See below for an example.
In addition to viewing historical job data, the History Tab can be used to delete job records and to export job data to Excel-compatible CSV files.
To delete job history records:
Click on the check box next to one or more Job #.
Click on the “Delete” button.
To export all data associated with a job history record to CSV files:
Click on the check box next to one or more Job #.
Click on the “Export” button.
Select a destination folder to save the .zip bundled CSV files.
The zip folder will have the following structure:
The Notes Tab is useful for storing notes about a restore. The text is free-form and saved in the CopyStorm/Restore configuration file.
Configure Rich Text Fields for pre-processing before Sending to Salesforce. Options:
Patch RT Images
Replaces all Servlet/RTA Image references with their Base64 encoded image data.
Note: Upon record insert/update, Salesforce will re-convert the Base64 body to an RTA Image.
While it is best practice to store Salesforce Reference Ids in Reference Fields, there are a handful of situations where a Reference Id may be stored in a Text field.
By default, CopyStorm/Restore will use Reference Field metadata to determine whether or not a field contains a Reference Id, and which table(s) the Id may reference. In cases where Reference Ids are stored in Text fields CopyStorm/Restore can be configured to treat the field as a Reference Field, which will cause CopyStorm/Restore to:
Take the reference information into account when determining the table restore order.
Use CopyStorm/Restore’s Old Id to New Id mapping to ensure referential integrity when uploading field values for the Text field.
To configure CopyStorm/Restore to treat a Text field as a Reference field:
The Candidate Scan Order tab lists the order in which Restore Set Editor rules will be traversed to find candidates to be restored.
Scanning for candidate records is a difficult problem due to direct and indirect circular relationship loops in Salesforce. For those of a graph theory bent, the problem of finding candidate records is a classic NP-Complete graph traversal problem in the same category as “The Traveling Salesman Problem” and finding minimal spanning ring systems in chemistry. Like all problems in this class, the search path is difficult to represent exactly in a linear set of steps. However, the plan displayed by CopyStorm/Restore is an honest representation of the search plan even thought the actual algorithm used by the search is a bit more complex.
There are a few core operations in a candidate scan:
A “Find Records in Table” step searches for records within the table. In the plan below, the “Find records in Account” is likely running a SQL statement against the Account table.
A “Scan Related List” step looks for records in a related list based on records selected in another table. In the plan below, step 5 in the plan finds Case records for all previously selected Account records.
<C:/Specified Path to file/Specified file name.zip/Specified file name/>RestoreJob.csv – Data from the History tab.
RestoreJobAutomation.csv – Data from the Automation Logs tab.
RestoreJobExceptions.csv – Data from the Exceptions tab.
RestoreJobPerformance.csv – Data from the Performance Logs tab.
RestoreJobSkipReasons.csv – Data from the Skipped Reasons tab.
RestoreJobTables.csv – Data from the Overview tab.








Create a file [CopyStormRestore]/config/CopyForceMetadata.xml
Use the following template to populate the file:
<CopyForceMetaData>
<!--
Treat the field Contact.TextField__c as a reference field which:
- Contains references to either the Account or Contact table.
- Uses a relationship name of MyCustomRelationship.
-->
<FieldRule table="Contact" field="TextField__c" relatedToTable="Account,Contact" relationshipName="MyCustomRelationship"/>
</CopyForceMetaData>Patch RT URIs
Finds and updates Salesforce record IDs embedded in RTA fields. When a record is restored or reinserted with a new ID, this option rewrites hardcoded references to reflect the correct restored record IDs
Supported Formats:
/001XXXXXXXXXXXXXXX
%2Fr%2FObject__c%2F001XXXXXXXXXXXXXXX%2Fview
NOTE: Only IDs that can be mapped using the Restore’s ID Map or Tracker Database will be replaced. Others remain unchanged. For more information on these functions, see Restore’s ID Map Documentation, and Tracker Database Documentation.
Salesforce records can hold many different formats of images in URLs. Making use of this configuration file allows for the addition of different Regex strings to allow support for new image URL formats in the field.
Setup
Navigate to “CopyStormRestore/Config” directory
Create an xml file and save it as “SFDCRecordIdTextReplaceUtilConfig.xml” inside of the “CopyStormRestore/config” directory.
The xml file consists of two tags:
The config file opening/closing tag.
Regex Entry tags. Each Regex entry tag has two components, a unique name or “type” that is a unique identifier for the entry, as well as a Regex string used to match against URL patterns. The capture group of these Regex strings needs to be the Salesforce ID of the image resource for pre-processing to be successful.
See below for the default configuration file:

<SFDCRecordImageUtilConfig>
<!--
The different types of SFDC image URL formats and their associated REGEXs to
strip out the target image information.
SFDC records can hold many different formats of images in URLs. This configuration
file allows for the addition of different REGEX strings to allow support for new
image URL formats in the field.
NOTE: The "<" and ">" characters are reserved in XML and cannot be a part of the "regex"
parameter. Replace those characters or other XML reserved characters with the following:
- "<" -> "<"
- ">" -> ">"
- (") -> """
-->
<!--
-> REGEX String:
-> (?:/r/[a-zA-Z0-9_]+/)([a-zA-Z0-9]{18}|[a-zA-Z0-9]{15})(?=/|$)
-> REGEX String Details:
-> Pattern: (?:/r/[a-zA-Z0-9_]+/)([a-zA-Z0-9]{18})(?=/|$)
-> (?: ... ): Non-capturing group, meaning it groups the enclosed pattern but does not store the matched value.
-> /r/: Matches the literal string /r/.
-> [a-zA-Z0-9_]+: Matches one or more (+) alphanumeric characterse and the underscore. This is used to match
to the Salesforce object name in the URL.
-> /: Matches the literal forward slash (/) after the Salesforce object name in the URL.
-> ([a-zA-Z0-9]{18}|[a-zA-Z0-9]{15}): Capture group, meaning this is the matched content that is stored. Matches exactly 15 or 18 alphanumeric
characters for the Salesforce record ID.
-> (?=/|$): Ensures that the match is only valid if the capture group is following by a '/', or it is the end of the string
Parses URLs in the formats:
-> https://exampleorg.lightning.force.com/lightning/r/Knowledge__kav/001Ec00000L3Pz4IAF/view
-> https://exampleorg.lightning.force.com/lightning/r/ContentDocument/0696Q00000CTZ9mQAH/view
-->
<SFDCImageFormat type="urlIdNoReference" regex="(?:/r/[a-zA-Z0-9_]+/)([a-zA-Z0-9]{18}|[a-zA-Z0-9]{15})(?=/|$)"></SFDCImageFormat>
<!--
-> REGEX String:
-> (?:%2Fr%2F[a-zA-Z0-9_]+%2F)([a-zA-Z0-9]{18}|[a-zA-Z0-9]{15})(?=%2F|$)
-> Pattern: (?:%2Fr%2F[a-zA-Z0-9_]+%2F)([a-zA-Z0-9]{18})(?=/|$)
-> (?: ... ): Non-capturing group, meaning it groups the enclosed pattern but does not store the matched value.
-> %2Fr%2F: Matches the URL encoding for the literal String (/r/)
-> [a-zA-Z0-9_]+: Matches one or more (+) alphanumeric characterse and the underscore. This is used to match
to the Salesforce object name in the URL.
-> %2F: Matches the URL encoding for the literal string forward slash (/).
-> ([a-zA-Z0-9]{18}|[a-zA-Z0-9]{15}): Capture group, meaning this is the matched content that is stored. Matches exactly 15 or 18 alphanumeric
characters for the Salesforce record ID.
-> (?=%2F|$): Ensures that the match is only valid if the capture group is following by a '/', or it is the end of the string
-> Parses URLs in the formats (Gets the second ID in the URL):
-> https://exampleorg.lightning.force.com/lightning/r/Knowledge__kav/001Ec00000L3Q00IAF/view?ws=%2Flightning%2Fr%2FKnowledge__kav%2F001Ec00000L3Q01IAF%2Fview
-->
<SFDCImageFormat type="urlIdSingleReference" regex="(?:%2Fr%2F[a-zA-Z0-9_]+%2F)([a-zA-Z0-9]{18}|[a-zA-Z0-9]{15})(?=%2F|$)"></SFDCImageFormat>
<!--
-> REGEX String:
-> (?:sfdc://)([a-zA-Z0-9]{18}|[a-zA-Z0-9]{15})
-> REGEX String Details:
-> (?:sfdc://)
-> Non-capturing group to find "sfdc://" right before the capture group
-> ([a-zA-Z0-9]{18}|[a-zA-Z0-9]{15})
-> Capture group matching alphanumerics 18 characters in length and if not, 15 characters in length.
-> Parses rich text in the format:
-> <p>this is test html<img src="sfdc://001ZZrecord7890123" alt="first tag"/>with two image tags<img src="sfdc://001ZZrecord7890123" alt="second tag"></img></p>
-->
<SFDCImageFormat type="sfdcTag" regex="(?:sfdc://)([a-zA-Z0-9]{18}|[a-zA-Z0-9]{15})"></SFDCImageFormat>
<!--
-> REGEX String: https://[^/"]*/([a-zA-Z0-9]{15,18})(?=(?:/)?")
-> REGEX String Details:
-> https://
-> Matches the HTTPS protocol
-> [^/"]*
-> Non-capture group to match everything after the domain name but stop at the next slash or quote, effectively skipping the host portion
-> /([a-zA-Z0-9]{18}|[a-zA-Z0-9]{15})
-> Captures the Salesforce ID after a slash (/) in the 18 or 15 character format
-> (?=(?:/)?")
-> Positive look ahead to make sure that after the pattern for the ID is either a quote (") or a slash and quote (/") for termination of the match
-> Parses rich text in the format:
-> <p><a href="https://example-data-12345-dev-ed.scratch.my.salesforce.com/kA0Ov000000S6IbKAK" target="_blank">Parent Article</a></p>
-->
<SFDCImageFormat type="urlIdNoObjectName" regex="https://[^/"]*/([a-zA-Z0-9]{18}|[a-zA-Z0-9]{15})(?=(?:/)?")"/>
</SFDCRecordImageUtilConfig>A “Find Records in Table Referenced By” step looks for records in a table based on the value of a reference field in another table. In the plan below, step 10 finds Contact records referenced by the field AccountContactRole.ContactId.
Record Filters in CopyStorm/Restore provide an easy way to limit record selection without writing SQL. Following these steps will enable CopyStorm/Restore to restore a specific set of records to Salesforce.
To limit restored records to specific criteria:
Select the “Filter” in the “Which Records” dropdown.
Click on the empty filter to edit.
Create the criteria by dragging and dropping fields and references.
Test the filter and validate the criteria.
Press “Save” to apply the filter.
To enable filter-based record selection for a table:
Select the table in the Restore Set Editor.
Update the “Which Records” selector to “Filter”.
Click on the “Click Here To Edit” button to open the filter editor.
Edit the filter by dragging and dropping fields and operators from the left-hand side of the dialog into the right-hand tree.
Referenced data can be filtered by expanding reference fields in the field tree.
Click on an item in the right-hand filter tree to edit the criteria. Pressing “Save” will save changes in the criteria editor, and pressing “X” will delete the criteria from the filter.
To test the filter and verify that it is finding the correct records, press the Preview button. This will query the CopyStorm database for a sample set of records that match the criteria and display them in the table.
To view all fields in the query results, select “All Fields” in the “Show” drop-down. To view the SQL query that was generated, press the “Show Query” button.
If the query results are correct, press “Save” to save changes to the filter and close the dialog. To close the dialog without saving changes, press the “Cancel” button.
Parameters for controlling the suppression of common record skipping reasons – for example: Child records may be skipped when their parent record(s) are skipped – this skipped reason is typically suppressed because it is a side effect of the parent being skipped.
Inactive Price Books
Record when an opportunity or quote references an inactive price book.
Inactive Prices
Record when an opportunity or quote line item references an inactive price (or a price in an inactive price book).
Missing Referenced Records
The Global Parameters editor is used to specify:
Parameters that apply to every table.
Parameters that apply to the overall restore process.
Parameters that are table specific, usually because of a Salesforce restriction.
Parameters that control details of skipped record reporting.
The Custom Object editor is used to select the precise components of a standard or custom SObject that will be restored.
For a partial restore only particular elements of a Custom Object should be deployed. The following example will do a limited restore of several custom fields.
A complete restore will cause all properties of a Custom Object to be deployed.
An expert restore provides fine grained control at the Custom Object XML level. The initial XML can be:
The XML corresponding to the current partial editor.
The current or any past CopyStorm backup.
The current definition in Salesforce.
For additional help see the page.
Parameters for controlling the level of parallelism and memory used when scanning the CopyStorm database for records to restore.
The Profile Set editor provides fine grained control for the restore of a Salesforce Profile record.
For a partial restore, specific sub-components of a Profile are selected for the restore. A partial restore is often used when migrating a Profile to a new environment where the original Profile contains entries related to objects/fields are not in the target Salesforce.
A complete restore will cause all properties of a Profile to be deployed.
An Expert restore provides fine control over the XML which is restored. See the for details.










Record when a record contains a reference Id that cannot be found (or was not restored). This is usually caused when a Salesforce table is missing from the CopyStorm database.
Missing Reference Rules
Record when a record contains a reference Id without a rule for restoring the reference. This is usually caused by using a CopyStorm/Restore configuration file that was created using a database with a different schema than the current database.




Parallel Reference Scans
The maximum number of queries that can run simultaneously when scanning for related records. This limit is Per-Candidate-Scan. For example, if “Parallel Candidate Scans” is set to 2, and “Parallel Reference Scans” is set to 3, there may be up to 6 related record queries running simultaneously.
Candidate Scan Batch Size
The number of records to process in a single batch when looking for candidates to restore (10 to 1000). Larger numbers can increase restore performance but will cause CopyStorm/Restore to use more memory.
Candidate Scan Parallelism
The level of parallelism to allow when scanning for restore candidates. Increased parallelism can increase restore performance but will cause CopyStorm/Restore to use more memory.
Available values are:
Minimal: Scan 1 table at a time, 1 batch of referenced records at a time, and wait until a table is fully scanned before scanning the next table.
Medium (Default): Scan 5 tables at a time, 5 batches of referenced records at a time, and start scanning referenced tables when there are 3 batches of records awaiting a scan.
High: Scan 25 tables at a time, 25 batches of referenced records at a time, and start scanning referenced tables as soon as there is a batch of records awaiting a scan.
Custom: Directly set scanning parallelism parameters.
Parallel Candidate Scans

The maximum number of tables that can be scanned for records simultaneously.
Snapshot Recovery is used to recover Salesforce data that is stored in a . This is useful in a variety of recovery scenarios when the data or schema contained within the primary CopyStorm data set is insufficient to perform a historical data recovery.
For example:
A field was deleted in Salesforce and is no longer contained within the primary CopyStorm data set.
Salesforce records must be reverted to their state at a known point-in-time.
Salesforce records modified during a known window must be reverted to the state the records took at a known point-in-time.
Selecting a Snapshot will configure CopyStorm/Restore to recover records from the specified Snapshot.
After selecting a Snapshot, CopyStorm/Restore will display Point-In-Time Recovery Parameters near the top of the application. These parameters are used to recover record data from a specific time or interval:
More information about CopyStorm/Restore’s Point-In-Time Configuration can be found either later in this document or within the Point-In-Time configuration dialog:
Point-In-Time configuration is driven by the Point-In-Time strategy selected in the “Recover” drop-down:
Most Recent: Recover the latest version of selected records.
A Point In Time: Recover the version of selected records closest to the selected date / time.
A Single Date: Recover records that were modified on a given date.
Between Two Times: Recover records modified between to dates / times.
When the “Most Recent” Point-In-Time Strategy is used, CopyStorm/Restore will use the record filtering and relationship rules configured on the Restore Set Editor tab to find records within the selected Snapshot.
If there are multiple versions of a record within the Snapshot, the version with the most recent modification time will be restored to Salesforce.
When the “A Point-In-Time” Point-In-Time Strategy is used, CopyStorm/Restore will use the record filtering and relationship rules configured on the Restore Set Editor tab to find records within the selected Snapshot, only considering record versions modified prior to the provided date/time.
If there are multiple versions of a record within the Snapshot, the version with the most recent modification time (prior to the provided date/time) will be restored to Salesforce. If a record is in the Snapshot, but no version of the record has a modification time prior to the selected date / time, the record will not be restored.
This Point-In-Time Strategy is used to revert Salesforce records to the values that the records held on a specific day and time.
Available date/time formats include:
dd-MMM-yy (19-May-1984)
M/d/y (5/19/84)
dd.MM.yy (19.5.1984)
dd-MM-yy (19-5-84)
yyyyMMdd (19840519)
yyyy-MM-ddTHH:mm:ss.sssZ (2021-02-28T18:32:24.373Z)
When the “A Single Date” Point-In-Time Strategy is used, CopyStorm/Restore will use the record filtering and relationship rules configured on the Restore Set Editor tab to find records within the selected Snapshot, only considering record versions modified from the start to the end of the provided date (/time).
If there are multiple versions of a record within the Snapshot, the version restored to Salesforce can be configured using the “Pick” dropdown. Available values include:
Latest Version – restore the version with the most recent modification time.
Earliest Version – restore the version with the oldest modification time.
If a record is in the Snapshot, but no version of the record has a modification time within the Point-In-Time Strategy interval, the record will not be restored.
This Point-In-Time Strategy will find records that were modified between:
If a day is provided:
The beginning and end of the day.
For example, if “2021-05-10” is provided, CopyStorm/Restore will find record versions with modification date / times between “2021-05-10T00:00:00.000Z” and “2021-05-10T23:59:59.999Z”.
If a day and hour is provided:
The beginning and end of the hour.
For example, if “2021-05-10T14” is provided, CopyStorm/Restore will find record versions with modification date / times between “2021-05-10T14:00:00.000Z” and “2021-05-10T14:59:59.999Z”.
If a day, hour, and minute are provided:
The beginning and end of the minute.
For example, if “2021-05-10T14:32” is provided, CopyStorm/Restore will find record versions with modification date / times between “2021-05-10T14:32:00.000Z” and “2021-05-10T14:32:59.999Z”.
When the “Between Two Times” Point-In-Time Strategy is used, CopyStorm/Restore will use the record filtering and relationship rules configured on the Restore Set Editor tab to find records within the selected Snapshot, only considering record versions modified from the start to the end of the provided interval.
If there are multiple versions of a record within the Snapshot, the version restored to Salesforce can be configured using the “Pick” dropdown. Available values include:
Latest Version – restore the version with the most recent modification time.
Earliest Version – restore the version with the oldest modification time.
If a record is in the Snapshot, but no version of the record has a modification time within the Point-In-Time Strategy interval, the record will not be restored.
The Permission Set editor provides fine grained control for the restore of a Salesforce permission set.
Warning: Restoring a Permission Set completely replaces its definition in Salesforce. Unlike Profile restores, Permission Set restores DO NOT incrementally change a Permission Set.
For a partial restore, specific sub-components of a Permission Set are selected for the restore. A partial restore is typically used when migrating a Permission Set to a new environment where the original Permission Set contains entries related to objects/fields are not in the target Salesforce.
A complete restore will cause all properties of a Permission Set to be deployed.
An Expert restore provides fine control over the XML which is restored. See the for details.



The Dependency Detail tab lists the order in which tables will be written to Salesforce, the referenced tables occurring later in the list of tables, and the original table dependencies from the Salesforce metadata.
This page contains similar content to the tab, including two additional columns.
The “All Required” column lists all tables that must be restored before the table in the second column.
The “All Nillable” column lists all tables that are referenced by nillable reference fields in the table in the second column.



The “Fields to Restore” editor determines which fields for each record will be restored to Salesforce.
By default all fields are selected.
If a field is not selected it will:
Be set to null for records inserted into Salesforce.
Be left unchanged for updated records.
Fields required for creating a new Salesforce record are marked as (required).
If any required fields are not checked then only update restore operations are permitted.
The editor contains filtering tools above a list of all available table fields. In the following screenshot the filter has been used to only show fields whose name contains the text “Billing”:
Other “Fields to Restore” options:
The “Field Obfuscation & Masking” button launches a dialog used to control how individual fields are restored.
The “Transformer” column indicates that a data transformation should be applied BEFORE data is written to Salesforce. In the example screenshot two columns have been assigned to transformers. Available transformers include:
Asterisk
Converts a column to all **** before writing the field to Salesforce.
For example, “Rebecca” will become “*******”.
Email Scrambler
If the built-in Transformers do not perform the action you need, CopyStorm/Restore supports adding new Transformers. Contact if you want to learn how this is done.
Other columns on this dialog provide read-only information about each column in the corresponding table.
Lineage Recovery is used to restore historical, record-specific data.
An Example:
Account ACME has 5 lineage entries.
There is a process that deletes/inserts the ACME Account in Salesforce.
The phone number for ACME has changed across these versions.
Randomizes email address fields before writing them to Salesforce.
For example, the email “luck@casino.com” may become “AuFK@uuiLT.com”.
Email Append Invalid
Appends “.invalid” to email address fields before writing them to Salesforce.
For example, the email “luck@casino.com” will become “luck@casino.com.invalid”
Lorem Ipsum
Change a block of text to the infamous “Lorem ipsum dolor sit amet, consectetur adipiscing…”
Random: Account Name / City Name / Country Name / Street Name / First Name / Last Name / Job Title
Converts a column to a value selected randomly from a dictionary.
The value will be selected from a built-in dictionary containing values for the indicated type (e.g. “Random: Account Name” will use a dictionary of Account Names).
Uniform: Account Name / City Name / Country Name / Street Name / First Name / Last Name / Job Title
Converts a column to a value selected non-randomly from a dictionary. The same input value will always provide the same output value.
The value will be selected from a built-in dictionary containing values for the indicated type (e.g. “Uniform: Account Name” will use a dictionary of Account Names).
Scramble
Converts each letter or digit to a random character of the same class before writing the field to Salesforce.
Supports all numerical fields including phone, integer, or double.
For example,
“Rebecca” may become “Kiojjkl”
“567-45-0987” may become “778-33-0997”
“+44 45 345 8876” may become “+62 33 123 9567”
Same Year Date/Time
Converts a date or date/time field to a random date or date/time within the same year.
Selected
If checked, only selected fields will be displayed.
Invert
When pressed, the field selection will be inverted. All selected fields will be deselected, and all non-selected fields will be selected.
Clear
When pressed, all selected fields will be deselected.


The phone number for ACME needs to be reverted to its value as of April 1st 2025.
To restore this phone number to its value as of April 1st, 2025, a Point-In-Time Lineage Recovery can be used.
In order for CopyStorm/Restore to consider Record Lineage during restoration, lineage data must be available. To track a records physical evolution, Record Lineage Creation must be enabled.
To configure CopyStorm/Restore for Lineage Restoreation, start by enabling the Lineage candidate scanning parameter in “Global Parameters” -> “Record Lineage Parameters”
Lineage records can exist within the Primary CopyStorm Database or within a Snapshot.
For example, CopyStorm is configured to disregard deleted records from the Primary Database & store in the “Default Recycle Bin” Data Set.
Options:
Most Recent: Recover the latest version of selected records.
A Point In Time: Recover the version of selected records closest to the selected date / time.
A Single Date: Recover records that were modified on a given date.
Between Two Times: Recover records modified between to dates / times
Configure Record Selection Parameters in the Restore Set Editor tab.
Following the example, we will search for the ACME Account:
During Lineage Restoration, Record Previews will display which Lineage Version is found as a potential recovery candidate.
In the example above, the Lineage Version is:
Legacy (34)
Legacy indicates that this particular record is NOT HEAD.
The number in parenthesis (34) indicates how many versions it is away from the HEAD version. In this case, the resulting record is 34 versions earlier than the HEAD revision.
After configuring Record Selection Parameters, navigate to the Restore tab and scan for candidates.
After Candidate Scan is completed, candidates can be viewed on the Tracker Database tab.
During the Restoration, CopyStorm/Restore will:
Recognize that 001WH00000H2VAnYAN is Legacy lineage
Look for the HEAD revision of the “ACME” Account
Find the ID of the HEAD Revision & Confirm its existence in Salesforce
Match 001WH00000H2VAnYAN to the HEAD ID
There are countless use cases for Lineage Recovery. If you’re unsure how to apply it to your specific scenario, please contact support@capstorm.com for guidance.






