Migrate Attachments to Chatter Files

posted Apr 27, 2016, 1:37 PM by Ezra Kenigsberg
Q: "How can I migrate my org's Attachments to Chatter Files?"

A: With Doug Ayers's Convert Attachments to Chatter Files utility (inspired by Chirag Mehta). Here are step-by-step instructions for the code-averse:
  1. Install the unmanaged package (to Production or Sandbox).
    • Provide login credentials if prompted
    • Default install options are fine:
  2. Select "Developer Console" from any page's User Menu:
  3. In the Developer Console, select "Debug | Open Execute Anonymous Window":
  4. Replace any text in the window with the red line below, then click the "Execute" button.
    Database.executeBatch( new ConvertAttachmentsToFilesBatchable( false ), 100 );
  5. Confirm migration success by examining the "Failures" column of the table in Setup | Apex Jobs. If any jobs failed, replace the 100 above with a smaller number (like 50) and re-run.
Once you've confirmed all Attachments have been migrated to Chatter Files, you can delete the legacy Attachments using Data Loader; shoot me an email if I should write up those instructions!