We have moved all our Notes and Attachment to FIles in lightning, Now none of our Community plus users are able to view the files from their community login. We have added files related list on page layout but it isn't showing up. We have also made sure their profile has access to files. What is more strange to see is, If community users go to files tab and search for any existing file they can find it from the files tab but not on the record. I tried comparing one of the files, and from my login, I can see the file is Shared with a record but the same file from community user login doesn't show any record it is shared with. Anyone else facing this issue? We have more than 700+ community users who are finding files missing from the records which technically isn't true.

3 Answers 3


this is because you have Visibility as InternalUsers on ContentDocumentLink for each ContentDocument record, that represents lightning Files.

In order, to grant visibility access for Community users, you have to update Visibility to AllUsers for those files that should be visible to community users.

  • AllUsers—The file is available to all users who have permission to see the file.
  • InternalUsers—The file is available only to internal users who have permission to see the file.

Code to update all ContentDocumentLink records. If you don't have to do it for all Files, select only filtered records:

List<ContentDocumentLink> toUpdate = new List<ContentDocumentLink>();
for(ContentDocumentLink link : [
    select Id, Visibility
    from ContentDocumentLink
    where Visibility != 'AllUsers'
    link.Visibility = 'AllUsers';
update toUpdate;
  • Thanks for responding, I'm non dev and dont have much knowledge about the code, Do i just copy the code and paste it as it is? I just tried updating the same code and got an error as "Unexpected token 'List'." Can you please assist. This has affected our more than 700+ community users. Nov 18, 2018 at 22:06
  • @MohammedSiddique where are you trying to perform this code snippet? in antonymous apex? Nov 19, 2018 at 6:05
  • I refreshed our Dev Sandbox and then in Sandbox>Developer Console>New>ApexTrigger>I have selected sObject as "ContentDocumentLink" and pasted the above code and it gave me the error message as "Unexpected token 'List'." Not sure if I'm doing anything incorrectly. Nov 19, 2018 at 13:12
  • @MohammedSiddique no, you have to run that code in anonymous apex Nov 20, 2018 at 7:10
  • I just run this code from Dev Console> Debug>Open Execute Anonymous Window and paste the Code as it is updated when i execute it gave me error as "Line: 2, Column: 32 Implementation restriction: ContentDocumentLink requires a filter by a single Id on ContentDocumentId or LinkedEntityId using the equals operator or multiple Id's using the IN operator." Nov 21, 2018 at 20:02

Without the right code, Salesforce user can share Notes and Attachment with community user below links just follow the below setting.


  • Can you post the relevant information here? It's been fagged as link-only answers tend to break over time.
    – Matt Lacey
    Jul 16, 2020 at 5:16

By default files object created under related list will follow this behavior . In short , files will not be accessible by Community user license ( External users) but only Standard user license (Internal Users ) because those file visibility properties value was set as "InternalUsers" on SFDC database level

To escape from this problem , like your case you want to allow community user see file in related list . You need do 2 thing.

First , on Developer console screen , Use APEX trigger to make sure new inserted file will always visible to "All users" , here is the code.

trigger ContentDocumentLinkTrigger on ContentDocumentLink (before insert) 
    //This trigger will make all new inserted files visible to Community Users
    for(ContentDocumentLink l:Trigger.new) {

Then , find a way to mass reset old database value , and i think Oleksandr Berehovskyi had answered that

You must log in to answer this question.

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