Using Files and Attachments in Flow
Here’s some information you might find useful when incorporating files and attachments into your Flow.
Documents (like Word, PDF, Excel, images) can be associated with Salesforce records.
The old way to do this was as Attachments. An Attachment can be queried with a Get Records, and is linked to a record via the ParentId field:Ver
Files and the Content Family of Entities
However, Salesforce has replaced the Attachment paradigm with a more flexible and modern mechanism that allows for multiple versions of a document to exist. This mechanism involves three different types of entity:
- Content Document represents the core file
- Content Version represents a specific version of the Content Document. A Content Document can have multiple Content Versions
- Content Document Link is used to connect a Content Document to a record.
Sending Attachments in Email
Salesforce provides a powerful email sending service, and the Send HTML Email action allows you to use it in Flows. The Email services uses an entity called an Email File Attachment which is similar to the Attachment object described above. Because of this similarity, the Send HTML Email action has been designed to accept a collection of Attachment objects. If you have records that include Files stored in the Content Document and Content Version format, you’ll want to use the ConvertFilesToAttachments action. This action takes a collection of Content Document Links which is useful because that’s the object you’ll want to do a Get Records query on when querying for all of the files associated with a record.