Send File not in Static ResourcesThursday, June 29, 2023 at 01:04pm
I am getting an error error.validation.sendPackage.noApprovals from the Salesforce Package.
There's plenty of customization on the Apex class and everything works as long as the file is in the Static Resources. However, when I try to upload a file associated with a record, this is the error that I'm getting. For troubleshooting, I'm including an ID of the record I'm pulling the file from in the initial query.
ContentDocumentLink cdl = [SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = 'a1FDK000001DLRc2AO'];
String fileID = cdl.ContentDocumentId;
ContentVersion file = [SELECT Title, VersionData FROM ContentVersion WHERE IsLatest = TRUE and ContentDocumentId=:fileID];
Map doc = new Map();
doc.put('Sample Document', file.VersionData);