Workaround for ContentDocumentLink requires a filter by a single Id

Workaround for ContentDocumentLink requires a filter by a single Id

“Query All Files” Permission can be used when we hit the exception “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”.

Exception:

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.

SOQL:

SELECT Id, LinkedEntityId, 
ContentDocumentId
FROM ContentDocumentLink

Resolution:

Salesforce Query All Files Permission can be used.

1. Create a Permission Set. 

2. Enable “Query All Files” Permission.

3. Assign the Permission Set to the user who wants to run SOQL on all files.

Leave a Reply