Friday, October 23, 2015

Salesforce: Attach File to a Record

Background: support users only have read-only access to Opportunity, but to attach file or edit attachment linked to a record Salesforce, user need to have edit record permission.

Attachment versus File
There are 2 technologies available in Salesforce to attach file to a record in Salesforce. Attachment has been available for long time and do not see any enhancements recently, while File is newer and keep enhance in last few releases, both can be used to link file to a record.

What is the different?
Search *
File name and Content search-able
File name search-able
Permission to add
Read record permission
Edit record permission
Where to add
Chatter feed
“Notes & Attachments” related list
Report *
By user upload the file

* search -  the system need 5-15 minutes to index the content depend on the file size, until the content searchable.
* report - only file shared to the user will be in the report, even you are admin, the file will be not in the report

To attach file to a record, scroll down to "Notes & Attachments" and click Attach File related list.

To use file in an object, first of all, you need to enable Chatter Feed. Example for a custom object called Service, navigate to Setup | Customize | ChatterFeed Tracking, look for Service and select Enable Feed Tracking.

Once Chatter Feed enabled for that object, you will notice "Show Feed" panel added at top of the record page layout.



Click Show Feed to see available actions:

If you do not see File option there, check the object page layout and make sure File action is added in Quick Actions in the Salesforce Classic Publisher.

Files uploaded as "File" from Chatter Feed will be added to "Notes & Attachments" related list.

If you notice the difference of File and Attachment in the related list:
  • Different Type
  • File extension will include in attachment, while not in File
  • You can edit attachment to change Attachment name, but nit for File
  • You can preview File for supported file type, but not for Attachment

Even you are admin, and able to see the file, it will be not in the File report if the file is not share to you.

Following report run by me as admin:

And the same report run as user:

Notice that a file called "fish" is not available in my report, because it do not share to me.

ReferenceConsiderations for Managing Files and Notes Attached to Records