0 votes

I have a custom object that gets created via a Flow, in that Custom Object I have a 'Type' and if Type is "A" then it allows users to UploadFiles, these files then end up in Related Files.

I need to grab this file and put it into an email to do that I first need to have a Unified Name for that File so I can Query and grab it, in order for that to happen I need to be able to change the file name to 'Error Wow ' or anything so when I am doing an Email send process I can Query [SELCT File from Attachments where Name = 'Error WOW'] or something like that.

Is there a way of doing this, I been reading all over I found a great code in this post but it didn't work it kept on giving me errors.

Please let me know what else I can do or if there is another way of sending an Email from Apex and grab every attached file related to that record without having to know the name of the file.

Thanks in Advance!

1 Answer

0 votes
Best answer

Uploaded files go into the ContentVersion object. (isn't that obvious! just kidding). They are connected to an object via the ContentVersionLink object.

The ContentVersion has an attribute called Title, and that should be where you can update the filename. https://developer.salesforce.com/docs/atlas.en-us.230.0.object_reference.meta/object_reference/sforce_api_objects_contentversion.htm

Welcome to Memory Exceeded, where you can ask questions and receive answers from other members of the community.
You can donate any amount for Orphans village using following QR Code.