There are different visibility types available for files shared on Salesforce records, including AllUsers and InternalUsers. When you query the ContentDocumentLink object, you will find different Visibility field values for different records.
This article explains what affects the different types of visibility and how visibility is assigned by default when a file is shared on a record.
There is no setting for the default visibility of files shared on records, but having a community (Experience Cloud site) changes the visibility options.
Default Visibility Behavior:
Example 1 — Org with no communities:
Attach a file to an Account record in an org with no communities enabled. Query the ContentDocumentLink object using the Account Id in the WHERE condition:SELECT ContentDocumentId, LinkedEntityId, Visibility, ShareType FROM ContentDocumentLink WHERE LinkedEntityId='[AccountId]'
The result shows Visibility = AllUsers for the new file.
Output:
| ContentDocumentId | LinkedEntityId | Visibility | ShareType |
| 0693D0000005ixzQAA | 0013D00000QEgMaQAL | AllUsers | V |
Example 2 — Org with communities enabled:
Enable Communities and attach a new file to the same Account record. Run the same query again.
The result shows the previously attached file remains Visibility = AllUsers, while the newly attached file shows Visibility = InternalUsers.
Output:
| ContentDocumentId | LinkedEntityId | Visibility | ShareType |
| 0693D0000005ixzQAA | 0013D00000QEgMaQAL | AllUsers | V |
| 0693D0000005jGDQAY | 0013D00000QEgMaQAL | InternalUsers | V |
Overriding the Default Visibility:
The default visibility can be overridden in two ways:
ContentDocumentLink (CDL) between the file and the record, set the Visibility field to 'AllUsers' in your Apex trigger. For example, loop through the new ContentDocumentLink records in a trigger and set cont.Visibility = 'AllUsers' before insert.for(ContentDocumentLink cont : Trigger.new)
{
cont.Visibility = 'AllUsers';
}
000384243

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.