Can users with the Salesforce Platform license access Files, ContentDocument/ContentDocumentLink/ContentVersion, using Apex? I created a class using without sharing to query for ContentDocument records that are related to a custom object. The debug shows the methods are never entered for a user with Salesforce Platform license. Is there a profile permission that may be needed to give access to the Files? Or, access to the Library the Files are in? Or, sharing the Files?

public without sharing class FilesUtility {
    public static List<String> getFilesByAgreement(string id) {
        system.debug('*************************************************** we are inside the getFilesByAgreement method');
        List<String> options = new List<String>();
        Set<Id> contentDocumentIds = getContentDocumentIds(id);
        for(ContentDocument cd : getContentDocuments(contentDocumentIds)) {
            String label = cd.Title;
            String value = cd.Id;
            String s = '{"label": "'+label+'", "value": "'+value+'"}';
        return options;
    private static Set<Id> getContentDocumentIds(string id) {
        system.debug('*************************************************** we are inside the getContentDocumentIds method');
        Set<Id> retval = new Set<Id>();
        for(ContentDocumentLink cdl : [select ContentDocumentId from ContentDocumentLink where LinkedEntityId =: id]) {
        return retval;
    private static List<ContentDocument> getContentDocuments(Set<Id> contentDocumentIds) {
        system.debug('*************************************************** we are inside the getContentDocuments method');
        List<ContentDocument> retval = new List<ContentDocument>();
        return [SELECT Id, Title FROM ContentDocument WHERE Id in: contentDocumentIds];
  • 2
    Can you check if the 'Salesforce CRM Content User' checkbox is set to true on the user record? if not try enabling it then check. Commented May 4, 2021 at 16:18
  • I tried enabling 'Salesforce CRM Content User' checkbox on the user record but the Files still do not show up.
    – Dman100
    Commented May 4, 2021 at 16:35
  • 1
    if the methods are never entered (if those debug statements don't show up), surely it's a different issue? does the profile of the users have apex class access to FilesUitlity? Commented May 4, 2021 at 16:51
  • Thank you! I think the issue was access to the class for that profile. The files are pulling back now. Thanks again!
    – Dman100
    Commented May 4, 2021 at 16:56

1 Answer 1


If it was a Files access issue, your debug statements would still show up as the methods would be called before getting to the query.

Since the logs do not show your debug statements, it's safe to pinpoint the issue to being the user accessing the method (and by extension class).

Winter '21 had an update to restrict access to @AuraEnabled methods based on user profile.

This update gives you more control over which authenticated users can access Apex classes containing @AuraEnabled methods. When this update is enforced, an authenticated user can access an @AuraEnabled Apex method only when the user’s profile allows access to the Apex class. This update is enforced in Winter ’21.

Making sure the user's profile has access to this apex class will ensure that the method does get called.

You must log in to answer this question.

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