How to Convert Attachments in Salesforce to Chatter Files

stack of filesAs Salesforce Administrators, Developers and Users await the release of Winter ’17 from Salesforce, it’s important to make sure you are taking advantage of features that have rolled out in previous releases.

In the Salesforce Winter ’16 release a new related list called Files was introduced to better support notes & attachments across all platforms which is based on Chatter Files.

Utilizing Files instead of Attachments provides a lot more capabilities around sharing the file with other users, groups, or records.  It also supports file previews, revisions and syncing files with your desktop.

Many Salesforce customers have been looking to make the switch.  Organizations created after Winter ’16 have the Files related list on page layouts for many objects by default, so new customers can just take advantage of this capability.

However, for existing Salesforce customers it gets more complicated because Salesforce has not provided a way to convert notes and attachments over to the new Files capability.

Doug Ayers (a Salesforce MVP) has created a nice utility to assist with this conversion for any customers looking to make the switch.


Here is how you can take advantage of that utility if you are a Salesforce Administrator or Developer:

  1. Make sure the enhanced notes setting is enabled.

Notes Settings Salesforce

 

  1. Install the unmanaged package in your environment:
    • Click appropriate install link:

Production or Sandbox

  • Enter your Salesforce credentials if needed
  • Leave defaults on Package Installation page

Salesforce install converted notes

 

  1. Click the User Menu and Select Developer Console

salesforce developer console

 

  1. Click on Debug > Open Execute Anonymous Window

salesforce open execute window

  1. Enter in these 2 lines in the Window and press Execute. This will run the conversion do the p set the batch size.
Database.executeBatch( new ConvertAttachmentsToFilesBatchable(), 100 );
 Database.executeBatch( new ConvertNotesToContentNotesBatchable(), 100 );

If you run into governor limits, you may need to reduce the batch size of 100.

You can also optionally choose to delete the original notes and attachments upon conversion by passing in a Boolean.

Boolean deleteUponConversion = true;
 Database.executeBatch( new ConvertAttachmentsToFilesBatchable( deleteUponConversion ), 100 );
 Database.executeBatch( new ConvertNotesToContentNotesBatchable( deleteUponConversion ), 100 );

Example Results:

Before:

salesforce results example 1

 

After:

salesforce results example 2

Hope you enjoyed this Salesforce Tip!

As we await the new release from Salesforce, check out Ledgeview’s on-demand recording of “What’s New with Salesforce Summer ’16” webcast.

About Ledgeview Partners

Comments are closed.