Loading

Experience Cloud Users Unable to See Files on Records – How to Enable File Visibility Using Apex Trigger

Data pubblicazione: Jul 9, 2026
Descrizione

Why This Issue Occurs

Experience Cloud (community) users cannot see files linked to records via the ContentDocumentLink object unless the "Customer Access" setting is explicitly enabled on each file. By default, Salesforce sets the Visibility field on ContentDocumentLink to "InternalUsers" when a file is uploaded to a record. This makes the file invisible to Experience Cloud users even if those users have access to the parent record.

Current Limitations

There is currently no out-of-the-box setting to enable Customer Access by default for new or existing files. This is a known platform limitation. The following restrictions apply:

  • Not supported natively
  • No admin setting exists
  • A custom solution such as an Apex trigger or API call is required

This is a known limitation confirmed in the following Salesforce IdeaExchange posts:Clarification: Related IdeaExchange Post:
 Option to set Customer Access on Files by Default 


This link leads to a Salesforce IdeaExchange post, where customers have requested Salesforce to add the ability to set Customer Access = ON by default when files are shared to a record.
This is an IdeaExchange post, not an active feature.

  • Not supported natively
  • No admin setting exists
  • Requires custom solution (trigger/API)
Risoluzione

Workaround: Apex Trigger to Automatically Set File Visibility

To automatically set file visibility to AllUsers for all new files linked to records, create an Apex trigger on the ContentDocumentLink object that fires on before insert. The trigger should loop over each ContentDocumentLink record in Trigger.new and set the Visibility field to 'AllUsers'. This makes the file visible to all users — both internal and Experience Cloud (community) users — who have access to the linked record.
What this does: When a user uploads a file to any Salesforce record, the before insert trigger intercepts the ContentDocumentLink record before it is saved and overrides the default Visibility value from 'InternalUsers' to 'AllUsers'. No manual toggling of the Customer Access setting is required.
Note: This trigger applies to all new file uploads going forward. To update existing files, a batch Apex job or Data Loader update on existing ContentDocumentLink records with Visibility = 'InternalUsers' is required separately.

 

Apex Trigger  example:

trigger SetFileVisibility on ContentDocumentLink (before insert) {
  for (ContentDocumentLink cdl : Trigger.new) {
    cdl.Visibility = 'AllUsers'; // Makes file visible to internal and external (community) users with access to the record
  }
}

Numero articolo Knowledge

005101347

 
Caricamento
Salesforce Help | Article