Send a Document as an Attachment in Flow
Documents can be sent as email attachments from an Action element.
This action is typically used immediately after a successful Document Generation action to deliver a document to a Lead, Contact, or User.
To enable:
- Drag and drop a flow “Action” onto the flow canvas
- Select the “Document” category
- Select the “Send Email With Attachment” action
There are several configurable options for sending an email with document attachment (see complete settings below). One input variable is required:
- Attachment ID - An ID reference to a file Attachment of Chatter File (ContentVersion)
Attachment ID
The Attachment ID
is a 15 or 18-char ID to a Salesforce Attachment or Chatter File (ContentVersion). This document is attached to the sent email.
Optional Input Values
While these input values are optional, the document delivery action will apply validation rules that require some either/or inputs.
Either an Email Template Name (class template) must be provided OR the email body and subject must be defined.
Also, either the EmailToID or the Email To Name
Input | Valid Values | Default Value | Description |
---|---|---|---|
CC Email Addresses | CC email recipients. Comma separated values | Empty | A list of recipients to be cc’d on email message. |
Email Body | String(2048) | Empty | Enter the email body. Can include variables for personalized content. |
Email From Address | Any email address | Empty | The reply to email address. |
Email From Name | Text(255) | Empty | The email “From” name value. |
Email Save As Activity | True or False | False | Creates an activity on parent record when enabled. |
Email Subject | Text(1024) | Empty | The email subject |
Email Template Name | The API name for a classic email template. | Empty | Then defined, the email template will override the email subject and body. |
Email To ID | A lead, contact, or user ID | Empty | When used in conjuction with EmailTemplate Name, the Email To record is merged with the email template body. Example {!Contact.Name} is merged using the EmailToID |
Email To Address | A valid email | Empty | The email recipient. |
Email To Name | Text(255) | Empty | The email recipient’s name. |
Run Asynchronous | True or False | False | Determines if the action is executed in a @future method context. Because this action makes an API callout, any uncommitted DML may throw an exception. Set Run Asynchronous=True to avoid this type of error. |
Output Values
The following outputs are returned from this action. It’s generally best practice to capture the Success and Message values in variables, particularly in screen flows, for use in providing the user feedback.
Input | Values | Description |
---|---|---|
Success | True or False | Indicates whether the document generation action was successful. If False then details of the error are available in the Message output value. |
Message | null or String value | Populated with error message details when Success=False . |
Run Asynchronous | True or False | Reflects the input value setting. |