Automate Email with Document Attachments
Use this pattern when you want to send a Viewer-generated document using Salesforce Flow native Send Email action (no custom email invocable required).
Goal
In one Flow:
- Generate the document using Viewer invocable action.
- Get the file ContentVersion Id.
- Use Send Email (native Flow action) and pass the file as attachment.
Prerequisites
- A Flow that already knows the target record (for example Opportunity, Quote, or custom object).
- A generated Salesforce File (Viewer output) linked to that record.
- Recipient email value available in Flow.
Flow design (native Send Email + attachment)
Step 1: Generate the document (Viewer invocable action)
At the beginning of the Flow, add the Viewer invocable action that generates the document.
This step must run first, so the generated file is available for the email attachment step.
Step 2: Get the file to send (from invocable action result)
Use the output of the Viewer invocable action from Step 1.
From the action result, keep the generated file ContentVersion Id in a Flow variable.
If your action output does not directly expose the ContentVersion Id, use Get Records as a fallback to fetch the generated file.
Step 3: Prepare attachment IDs
Create a Text Collection variable (for attachment IDs), then add your ContentVersion Id to this collection.
The native Send Email action can use attachment IDs from Flow variables.
Step 4: Add Salesforce native Send Email action
In Flow, add Action → Send Email and map:
- To Addresses: recipient email field/variable
- Subject: your email subject
- Body: your message
- Attachment IDs: the collection containing ContentVersion Id(s)
Step 5: Save and test
Run Flow in debug mode and verify:
- Email is sent
- Document is attached
- Correct file version is attached
Recommended checks
- Ensure file generation step runs before Send Email.
- If multiple files exist, define clear sorting/filtering rules in Get Records.
- Test with real recipient addresses in a sandbox before production.