Fix Content Document Links

The Fix DocLinks tool repairs records in the Salesforce ContentDocumentLink table.  The Salesforce ContentDocumentLink table has query restrictions that make it impossible to efficiently perform an 100% accurate incremental backup. There are two primary reasons that block an 100% accurate backup.

  1. The ContentDocuentLink table cannot be queried only on its SystemModStamp field.
  2. ContentDocumentLink permission values can be changed and there is no way to find the changes efficiently because of reason #1.

In practice most customers will either never run this tool or run it on a weekly basis.

Running Fix DocLinks in a GUI

To access the Fix DocLinks GUI:

  • Select “Other Tools” from the top-level menu.
  • Select “Data Synchronization”, then “Fix DocLinks”.

The UI for the Fix DocLinks tool is minimal.

  • The top of the dialog controls how many concurrent queries to run against Salesforce and what data ranges to scan.
  • The middle part of the dialog has a large button for starting the search and text for reporting progress

The tool will report progress as it scans records and when finished will look like:

where:

  • Candidates = total  # of ContentDocumentLink records scanned
  • Inserted = number of ContentDocumentLink records inserted into the CopyStorm database.
  • Update = number of ContentDocumentLink records updated in the CopyStorm database.

Running Fix DocLinks as a Batch Job

The Fix DocLinks tool can be run as a batch job using the following syntax:

  • Windows
    • CopyStormMedic.bat -tool fixDocLinks -run configFile.copyStormMedic
  • Linux or Mac
    • sh CopyStormMedic.sh -tool fixDocLinks -run configFile.copyStormMedic