I have uploaded an attachment (salesfiorce_migration_guide.pdf) to an opportunity record from classic salesforce. The uploaded document record has the following actions where ‘view’ action is a link to download the file.
Next, uploading another file (router-sample.pdf) to the same opportunity record using upload file functionality in lightning. The uploaded files in the above and current scenario are shown below.
You may have noticed that both the files are in PDF format but the recently uploaded file has the pdf icon which we can preview the content without downloading. The other file which is uploaded as an attachment from classic salesforce is treated as a link here.
Therefore, how we can convert the attachments from classic view to files in Salesforce?
It’s possible to change the attachments to files by enabling a couple of checkboxes in GeneralSettings.
You can attach a file to the notes & attachments related list of record. The users who have access to the record can see the attached documents. The only way to share the record documents with others is by changing the org’s record sharing rules or posting documents in the chatter feed. Salesforce was trying to solve this in a better way.
Finally, In winter 16 release, Salesforce announced a new related list called files. The benefits of files are
- Version Control
- Preview & Options
- Share with multiple users and records
- Optimised for lightning
- Post to chatter
- Supports large size
The attachments are uploaded in the past cannot be converted as files by enabling the above settings. Run the script given below (script should run by the record owner otherwise it will throw errors).
Please see the code comments for details.
Note: Salesforce announced that after Winter 18 release, ‘Notes & Attachments’ related list will not have “attach and upload” button.
Don’t forget to share the post if you like it & bookmark the blog for future references.
If you have any comments or doubts on this post, Please comment on the box below.