I am trying to make a simple APEX Class that returns a records related attachments. When I do the following SOQL query in the Query Editor I get the 3 expected results:
SELECT Id
FROM ContentDocumentLink
WHERE LinkedEntityId = 'a36Ec00000001s9IAA'`
However, when I do the same query in my apex class, nothing is returned in the list. I have been stuck on this for a while and any help would be appreciated. The recordId value is displaying in the debug as it should. Here is my entire Apex class so far:
global class GetRelatedAttachments {
@InvocableMethod(label='Get Related Attachments')
global static List<ContentDocumentLink> getRelatedAttachments(List<FlowInputs> requests){
String recordId = requests[0].recordId;
List<ContentDocumentLink> IdList = [
SELECT ContentDocumentId
FROM ContentDocumentLink
WHERE LinkedEntityId =: recordId
];
System.debug('recordId: '+ recordId);
System.debug('List: '+ IdList);
return IdList;
}
global class FlowInputs{
@InvocableVariable
global Id recordId;
}
}