How Do I Restore Autonumbers (i.e. Case Number)?

When creating data in Salesforce, autonumber columns are given new values automatically. To override this behavior and restore historical autonumber column data with CopyStorm/Restore, there are two approaches that can be taken:

1: Restoring Data to Custom Autonumber Fields

Uploading data to a custom autonumber field requires that autonumber generation be disabled during the restore. It is always best practice to perform this task during a maintenance window to prevent users from creating data while autonumber generation is disabled.

To disable autonumber generation for a custom field while restoring data with CopyStorm/Restore:

  1. Go to the custom field in the Object Editor.
  2. Record the field information, including the next number in the sequence and the display format.
  3. Modify the field type, setting it to Text.
    • This will disable autonumber generation during the restore.
  4. Upload the data with CopyStorm/Restore.
  5. Modify the field type, changing it back to an autonumber.
    • This will re-enable autonumber generation.
    • Use the field information from Step 2 — potentially with a different sequence number depending on the data being uploaded.

2: Restoring Data to Standard Autonumber Fields

Salesforce’s standard autonumber fields (i.e. Case Number) come with an additional restriction — their field type cannot be modified. Uploading data to a standard autonumber field requires that the standard field be replaced with a copy used in place of the standard field.

To set up a copy of the standard field that can be used with CopyStorm/Restore:

  1. Create a new custom field to hold the autonumber data.
  2. Create an insert trigger to populate the new custom field:
    • If there is no data in the custom field, populate it by copying the standard autonumber field.
    • If there is data in the custom field, keep the data and don’t overwrite the field content.
  3. Use the custom field instead of the standard field throughout the Salesforce instance.
  4. Back up the Salesforce instance using CopyStorm.

After Salesforce is configured with a field to use when restoring the autonumber data, the custom field can be uploaded just like any other field in Salesforce — there are no special configurations needed during the restore process!