With Winter 16 release, Salesforce gave the ability to add Files related list to a Custom/Standard object record.


Though the documentation says "Files uploaded to a related list are visible only to those who can access the record where they reside, but those with access to the record can share it further (unless the file is frozen).", a community user who has access to the record, cannot see the files uploaded by other internal/external users.

Could any one please provide suggestions how to acheive this?

3 Answers 3


Files uploaded via this related list will only be visible to internal users, and this field is not editable.

One thing you can do is post the file to the record via the Chatter publisher, and specify the visibility in your post. This would give the attached file the same visibility as the post.

Another option is to write a trigger and edit the Visibility field of the ContentDocumentLink that is created when the file is uploaded. Although you might want this to be context aware so that you don't do this whenever any file is created (and also requires some technical knowledge).


Replace YOUROBJECTAPI with your object api name and it will share only files uploaded on a that object

trigger shareFilesWithCommunityUsers on ContentDocumentLink(before insert){

   Schema.DescribeSObjectResult r = YOUROBJECTAPI.sObjectType.getDescribe();
    String keyPrefix = r.getKeyPrefix();

      for(ContentDocumentLink cdl:trigger.new){
          cdl.ShareType = 'I';
          cdl.Visibility = 'AllUsers';
  • 1
    Instead of using cdl.LinedEntityID you might want to use cdl.LinkedEntity.Type
    – horzel_evh
    Apr 16, 2019 at 9:19
  • Except that would require an extra query
    – kurunve
    Mar 26, 2021 at 14:17

As citizen conn pointed out you can use a trigger to edit the Visibility to enable community users to view the file. Here's is the exact trigger you'll want so when internal users upload documents, community users can see it:

UpdateContentDocumentLinkVisibilityOnInsert on ContentDocumentLink(before insert)
       for(ContentDocumentLink l : Trigger.new)
       l.Visibility = 'AllUsers';

Context: With Files enabled, Community users can only see files that were uploaded INTO that community. (i.e., when an internal user with a full SFDC license uploads/creates a file and adds it to a record, the community users can't see it, eventhough you've shared the file with "The Entire Company" AND the community users have access to view the record.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .