How Do I Restore Attachments?
Before restoring Attachments with CopyStorm/Restore it may be useful to understand how Attachments are handled by Salesforce and how they are different from most tables. When a table in Salesforce contains a reference to another table is is almost always possible to know the type of table being referenced. For example, the Contact.AccountId field will always reference a record in the Account table. However, in the Attachment table, a number of reference fields are not so specific (e.g. Attachment.parentId) and can reference many built-in and all custom tables in Salesforce. This type of table is also known as “polymorphic” because they can “morph” into being a child of almost any type of table.
There is one primary rule to remember when restoring polymorphic table records:
- Records in a polymorphic table can only be restored when they are referenced by their parent table.
If this is a bit confusing, here is a specific example for restoring Attachments related to Accounts:
Step 1: Choose the Account(s) that own Attachment(s)
Step 2: Uncheck the Restore Type Options “Insert” and “Update”
This informs CopyStorm/Restore to avoid inserting or updating Account records. The application will still find candidate records — this is necessary because the Attachments to be restored reference Accounts.
Step 3: Choose the Attachments Related List
The following screenshot illustrates CopyStorm/Restore’s state after steps 1 through 3 have been completed:
Step 4: Optionally Add Constraints to Control Which Attachments Are Restored
To restore a particular Attachment, constrain the search using a filter. This is rarely necessary due to Attachments being largely static once attached to an object.
Step 5: Run the Restore
CopyStorm/Restore will find the Accounts, decide nothing needs to change, and then restore the Attachments.