As 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.
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:
- Make sure the enhanced notes setting is enabled.
- Install the unmanaged package in your environment:
- Click appropriate install link:
- Enter your Salesforce credentials if needed
- Leave defaults on Package Installation page
- Click the User Menu and Select Developer Console
- Click on Debug > Open Execute Anonymous Window
- 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 );
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.