I have the following code snippet in a Helper class that's being called by an After Insert trigger (modified to demonstrate my objective):
Set<Id> reuseIds = new Set<Id>(); reuseIds.add('a0g0R000001VnjMQAS'); List<ContentDocumentLink> allLinks = [SELECT Id, LinkedEntityId, ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId IN :reuseIds]; System.debug('allLinks.size() ' + allLinks.size());
The debug output is showing me that I'm getting zero results. However, when I run the same query in the debug console, I see the single row returned that I'm expecting.
I have included without sharing on the trigger Helper class even though my understanding is that's not necessary in a trigger, but it doesn't change my results.
Can anyone offer any clues as to what I may be experiencing here?