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.

When restoring polymorphic table records, the best way to find the records is almost always to start with 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

This informs CopyStorm/Restore that it should:

  • Restore Attachments.
  • Only restore Attachments that are directly related to the selected Account(s).

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.