>> Install Conversion Tool from GitHub <<
In the Winter 16 release, Salesforce introduces a new related list called Files. This new related list shows Salesforce Files (previously marketed as Chatter Files) shared to the record regardless if the file was uploaded directly on the record as you do with attachments.
In the Spring 17 release, Salesforce announces that after Winter 18 release the “Notes & Attachments” related list will no longer have an upload or attach button. Customers will be required to migrate to and adopt Salesforce Files. In fact, if you’re using Lightning Experience then Salesforce Files is the new de facto standard.
The Future is Salesforce Files
Migrating to Files instead of Attachments, or to Enhanced Notes instead of Notes, is a good idea because Salesforce Files provide you much more capabilities around sharing the file (or enhanced note) with other users, groups, or records. It also supports file previews and revisions. It is the future of managing content in Salesforce. Did I mention you can also sync files between Salesforce and your desktop?
The sharing aspect is really important here. With classic Notes & Attachments, you must upload them to a single record and anyone who has access to that record can see the attachment. The only way to share the attachment with others is to:
- compromise your org’s record sharing rules (not recommended), or
- upload the attachment to another record the users do have access to (ugh, creating duplicates now), or
- upload the attachment to a cloud sharing service like Office 365, Sharepoint, Dropbox, Google Drive, etc., or
- post it to Chatter (see where I’m going?).
By using Salesforce Files, you can share the file with users, groups, or records. If you needed to give someone access to the file but the user didn’t have access to the record the file was originally shared to, fine, just extend sharing of the file to the user and not compromise your org’s record sharing rules, and definitely not create more duplicates of the attachment.
Migrating from Attachments to Salesforce Files
At the time of this writing, Salesforce has not (yet?) provided an official conversion tool from Attachments to Files. (Update 7/20/2017, Salesforce Labs released a conversion tool to AppExchange in Summer ’17. My first look thoughts are posted here)
Since the Winter 16 release I’ve been developing and tweaking my own open source conversion tool. And as of Spring 17 release I’m happy to announce a new free managed package of this popular tool with a much more convenient user interface. Everything is still open source, but now much easier to deploy to production orgs without wrestling with unit tests.
This project enables the manual or automatic conversion of classic Attachments into Salesforce Files to take advantage of more sophisticated features, like sharing, revisions, larger file sizes, etc.
The package includes visualforce pages that let you:
- Configure sharing and conversion options
- Run test conversions
- Enable near real-time or scheduled conversions
Are you really sure I should migrate to Salesforce Files?
Yes, yes I am. But don’t take my word for it, check out these other Salesforce Files advocates:
- Why You Should Add the Files Related List to Your Page Layouts
- Add the Files Related List to Page Layouts
- 5 Reasons to Use Files Related List
- Chatter Files: A Better Option for Attaching Files to Records
- ContentVersion Documentation
Special Thanks
- Arnab Bose (@ArBose), Salesforce Product Manager
- Haris Ikram (@HarisIkramH), Salesforce Product Manager
- David Mendelson, Salesforce Product Manager
- Rick MacGuigan, a very helpful early adopter and tester!
- And to everyone who has provided feedback on this project to make it what it is today, thank you!
Feedback
Although I’ve done my best to test various org configurations with this tool, there’s bound to be an edge case I’ve not yet thought of. If you have any feedback about the conversion tool or run into a problem, please open an issue on the GitHub project. Make sure to check out the closed issues and FAQ section on the project page as your question or problem might have already been answered. Thanks!
Readers like you who converted Attachments also converted Notes
Make sure to check out my other open source project that converts Notes to Enhanced Notes.
Hello Doug
Thank you for your efforts to help the community. I have installed your app in my personal org and works fine. no issue. but it did not work in client sand box. I am getting error as “Required fields are missing: [Document_ID__c]”. I believe this field is in ContentVersion object and this field has many custom columns. Why the conversion code is looking into this object? as I understand to get the latest version!.
Any help is appreciated.
Thanks
LikeLiked by 1 person
I was able to resolve the issue.
LikeLiked by 1 person
Glad you got it worked out, Aboo. Thanks for the update
LikeLike
Hi Aboo, thanks for your interest in my conversion app. The field “Document_ID__c” is a custom field the client has added to the ContentVersion object. If the client has custom validation rules in their org, then that will need to be addressed either by modifying the conversion app’s code or relaxing the validation rules or disabling any existing triggers on the Attachment, ContentVersion, ContentDocument, and ContentDocumentLink objects.
LikeLike
Hi Doug,
Lately I’ve been receiving error emails where the log says the error is “insufficient access rights on cross-reference id”. These are all created by my user with a “guest user license”.
I was trying to get a debug log since I’m guessing that user doesn’t have access to some object (maybe files), but I’m not having any luck there. Any ideas?
I have the conversion also scheduled, so they get converted later at least.
LikeLiked by 1 person
Hi Ben, my guess is similar to your assumption — a limitation of the “Guest User License”.
You may want to keep an eye out on this new Spring ’19 feature about community users uploading files as that may help in your scenario.
LikeLike
Hi Doug,
I have a client who wants to make sure their converted ContentDocuments are Shared With not only the Document’s parent record but when the parent is a Task or a Contact they want the Content Document to be Shared With the Task’s or Contact’s Account too. The original Documents seem to work that way but I’m not sure how Salesforce does that. Does your tool create more than one ConentDocumentLink in these cases? If not I’ll need to use a data tool to identify these Accounts and create additional ContentDocumentLinks.
LikeLiked by 1 person
Hi Jeff, this conversion tool only creates one ContentDocumentLink per attachment converted and it links to the original Attachment.ParentId.
To have the record shared to different record or to multiple records, you’ll need to do some post processing.
Thanks for your interest in my tool.
LikeLike
Hi Dough,
could you please share the latest code unmanaged package please? we are trying to migrate object one by one. it will be really helpful.
Thanks
Alex
LikeLiked by 1 person
Hi Alex, thanks for your interest in my app. The attachment conversion code is available on GitHub at https://github.com/DouglasCAyers/sfdc-convert-attachments-to-chatter-files.
LikeLike
Hi Dough,
I am new to GitHub, Could you please let me know how to install latest unmanaged code to my private org as when I used “Deploy from Github” link available on https://github.com/DouglasCAyers/sfdc-convert-attachments-to-chatter-files, it installed old codes.
Thanks
Manoj
LikeLiked by 1 person
Hi Manoj,
GitHub is a hosting service for code such as this open source project.
You can learn more about GitHub with these resources:
* Git and GitHub Basics
* GitHub Video Guides
* GitHub Written Guides
* GitHub Help
* Try Git
LikeLike
Good morning Doug,
As the need to convert the attachment to files arose, I tried to install your Convert Attachment to File app in the sandbox. However, I encountered the following error:
We haven’t implemented the email integration in the system, so enabling the EnhancedEmail doesn’t make sense. Furthermore, we have another application called Email to Case Premium for replaces the basic out-of-the-box Salesforce Email-to-Case functionality. Please advise.
Thank you for you do for us!
Regards,
Meena
LikeLiked by 1 person
Hi Meena,
My conversion app requires Enhanced Email to be enabled so that it has access to check for the EmailMessage object. I understand not all customers enable this option, but for now it’s a requirement.
If this app doesn’t meet your needs, you might try options on the AppExchange.
Sorry for the inconvenience
LikeLike
Hi Doug,
When I tried deploying this to my org I am experiencing to Apex Test Case Failures both in ConvertAttachmentsToFilesBatchableTest.
Stack Trace: Class.ConvertAttachmentsToFilesBatchableTest.test_conversion_error: line 379, column 1
Stack Trace: Class.ConvertAttachmentsToFilesBatchableTest.test_preserve_original_inactive_owner: line 335, column 1
Any ideas?
LikeLike
Just wanted to follow up that I got this to work by doing the following.
Issue #1 line 379 in ‘test_conversion_error’ was due to a Trigger we have in our org on the Attachment object that automatically re-assigns EmailMessage attachments to Case records. I could have modified the trigger but it has been working in our org for over 3 years so I didn’t want to touch it. Instead I simply inserted a Case record first and set the ParentId of the EmailMessage to the Id of the Case. The test method worked fine after.
Issue #2 line 335 in ‘test_preserve_original_inactive_owner’ was simply that the ‘Standard User’ profile in our org did not have appropriate access to the objects in the test method.
Now because I made modifications I couldn’t simply deploy from git. I could have bundled everything one by one into a change set but instead I created a DX project with the code and pushed it that way.
LikeLiked by 1 person
I am getting this error while installing it on my free dev. environment.
This app can’t be installed.
There are problems that prevent this package from being installed.
(Convert_Attachments_to_Files_Log__c-Convert Attachments to Files Log Layout) The ActionId specified was invalid for ActionType QuickAction. Convert_Attachments_to_Files_Log__c-Convert Attachments to Files Log Layout: The ActionId specified was invalid for ActionType QuickAction.
LikeLike
Hi Mayank, how are you trying to install the app — deploying from GitHub or installing the managed package? The managed package option often is the easier route.
LikeLike
Is there way out for converting Documents ( Under documents tab in classic) to Files ( in LEX) ?
LikeLiked by 1 person
Hi Mayank,
I have started a project at https://github.com/douglascayers/sfdc-convert-documents-to-files, but the conversion of Documents and Folders to Libraries is non-trivial. The GitHub project is far from complete, but might give you some ideas.
LikeLike
Hello Doug,
If Salesforce is pushing to use Files and Enhanced Notes instead of Notes & Attachments, how is it that this “Show Email Attachments in Case Attachments Related List” is still happening? (it appears in Support Settings).
I believe the Files functionality is a very good enhancement. But it looks like it cannot be used a 100% because the “core” is not still 100% using it.
Do you agree?
P.S.: probably I’m missing something, but I’m doing my best to find how can I show the Email2Case attachments inside the Files related list Lightning component (with only Point and Click). 🙂
Thanks and regards,
LikeLike
Hi Douglas,
Thanks for the wonderful information. I am running into interesting issue. Email to case creates a case for us and we have a trigger on Attachment object which creates a record in Content Document object. This piece was written before Salesforce came with Email-to-Case files. This trigger is working fine in Production but not in the sandboxes that I created.
Records get created in Attachment object but trigger either does not get executed or does not move in Content Document. We do have Automated Case User as SYSTEM. I tried it with even my system admin account. Everytime … it’s same and does not work.
Is there some setting that gets turned off in Sandbox refresh/creation? Have you seen something like this? It’s hard to get approval from business if they can’t see it working 🙂
LikeLike
Hi Doug,
Firstly, Thanks for the wonderful tool:-) I have a quick question – Is there a way to move the attachments on Email template and Email messages to files?
LikeLike
Hi Doug. Great tool, but running into issues where it is not recognizing attachments where the first character is a bracket, or the first word is wrapped in a bracket. I thought the first pass at Account attachments was low, and this is why. Is there a fix for this? TIA
LikeLike
NVM I figured it out. Those are attachments from child records, and they do get added, they just don’t roll up to the parent like Notes & Attachments.
LikeLiked by 1 person
Is there a way to have the Schedulable job ignore an attachment? I have some dumb app that has issues when an attachment is converted for it.
LikeLiked by 1 person
Hi Ben, sorry, there isn’t a filtering option in this package at this time. Would be a good feature enhancement though
LikeLike
I was able to install just fine, but the installation messed up a profile and its classes and triggers access. It was very weird. Can i know why it reacted that way?
LikeLiked by 1 person
Hi Sanjay, when you install a package you choose which profiles should get access. That would modify, for example, the System Administrator profile settings for access to any Apex code in the installed package.
That behavior is not specific to my package but rather a side effect of how Salesforce installs packages.
https://help.salesforce.com/articleView?id=distribution_installing_packages.htm&type=5&sfdcIFrameOrigin=null
LikeLike
Hi Doug,
We’ve recently switched to Lightning for some of our users. We’re still using Notes & Attachments until everyone is switched. We have a window scheduler job that calls apex classes that convert opportunity notes into PDF format. Those PDFs are then imported into OnBase (our active client CRM). However, we now noticed that files uploaded in lightning are not being imported. Thoughts or direction on apex updates needed to pull those files into the import as well?
Thank you!
Joe
LikeLike
Hey Doug! Thanks for sharing this app. I have leveraged your resources and support a few times in my org and am sincerely grateful for the knowledge share. I have an issue with one user where I am a bit stumped. He’s doing something that is throwing an Error: Convert Attachments to Enhanced Attachments message. When I review the log, the additional error details captured indicate unable to obtain exclusive access to this record or 1 records: 07H prefix. All the errors related to this user point to the same ContentFolder. I queried the old attachment Ids related to these records and did find that all contain png files with sequentially generated names (i.e. image103.png, image104.png, etc.) In speaking to the user, the errors seem to unknown to him. Again, this is limited to just one user and I installed this package well over a year ago. Any ideas? Your insight would be greatly appreciated. Thanks and hope this finds you well
LikeLike
I am seeing the same error in my org, did you find a work around for this?
LikeLike