Menu

How to Send Emails with Attachments in Salesforce Flow Builder

Salesforce Flow Builder is an incredibly powerful tool that allows users to automate business processes and workflows with ease. One of the most useful features in Flow Builder is the ability to send emails automatically as part of your automation process. But what if you need to send an email along with an important document or file? In this blog post, we’ll walk you through the steps on how to send emails with attachments using Flow Builder, enhancing your emails and providing valuable content to your recipients.

Why Send Emails with Attachments?

Sending emails with attachments through Flow Builder can be essential for various business use cases, such as:

  • Sending invoices or receipts automatically after a customer makes a purchase.
  • Sharing product documentation, reports, or guidelines with team members or clients.
  • Automatically providing users with specific forms, contracts, or other essential documents directly through email.

The process is simple, and once set up, it can significantly improve communication and reduce manual effort.

How to Send Emails with Attachments in Flow Builder

Follow these steps to send emails with attachments using Salesforce Flow Builder:

Step 1: Create Your Flow

  • Navigate to Salesforce and open Flow Builder.
  • Create a new flow by selecting Flow in the setup menu and then clicking New Flow.
  • Choose the appropriate flow type (e.g., Record-Triggered Flow, Scheduled Flow, etc.) depending on your use case. For my use case, I have selected the Record-Triggered Flow. Below is the example that describes how to send emails with attachments in Salesforce Flow Builder.

Step-by-Step Guide: Sending Attachments Based on Checkbox in a Record-Triggered Flow

Step 1: Create the Record-Triggered Flow

  1. Navigate to Flow Builder:
    • From Salesforce, go to Setup and search for Flows.
    • Click New Flow and select Record-Triggered Flow.
  1. Select the Object:
    • Choose the Account object (since you’re sending the email to an Account) as the object that will trigger the flow.
  1. Set the Trigger Criteria:
    • You want the flow to run when the checkbox field is True on the Account record is checked. Set the trigger condition to:
      • Record is Updated
      • Condition Requirements:  Send File to Customer(send_file_to _customer__c) field should be TRUE

Step 2: Get the Document of File: 

  • In this example we stored one attachment in a file, and we have to get that Attachment Id , we need a content version id of that File.

Step 3: Add the Send Email Action

  1. Add a Send Email Action:
    • Click the + icon on the flow canvas and select Action.
    • Search for Send Email and select it.
  1. Configure the Email Action:
    • Recipient: Use the Account record’s owner ID to send the email to the correct address.
  • Subject: Set the subject of the email (e.g., “Your Privacy Policy and Terms and Conditions”).
  • Email Body: Craft the email body content,
  • Attachment ID:
    • Turn on the Attachment ID field in the Send Email action.
    • Add the Document ID or Content Version ID of the Privacy Policy and/or Terms and Conditions document. In the step 2 we retrieve the content version Id of the file.
  • If you have more than one document to send you can provide multiple IDs in a comma-separated list.
  • Example for attaching two documents:
    0691t000000Xyz1AAC, 0691t000000Xyz2AAC

Step 4: Activate the Flow

Once you’ve confirmed that the flow is working as expected during testing, activate it so that it runs automatically when an Account record meets the specified condition (i.e., the checkbox is checked).

Step 5: Test the Flow

  1. Create or Update a Record:
    • Update an Account record and check the checkbox (e.g., “Send file to costumer”).
  1. Check the Email:
    • Ensure that the email is sent to the correct recipient (Account’s owner email).
    • Verify that the correct documents (Privacy Policy and/or Terms and Conditions) are attached.
  1. Verify the Attachments:
    • Open the sent email and check that the correct files are attached.

Important Considerations

  • File Size Limit: The maximum size of the email created, including attachments, is 35 MB. If you try to send attachments that exceed this size, the email will fail to send.
  • Attachment Types: As mentioned, you can attach Documents, Content Versions, or Attachments. Be sure that the files you want to send are available in one of these formats.
  • Flow Limits: Depending on your Salesforce edition (Essentials, Professional, Enterprise, Performance, Unlimited, or Developer), there may be certain limitations or restrictions regarding the availability of the Send Email action or other flow features. Be sure to check your edition and ensure the feature is available..

Final thoughts

Sending emails with attachments in Salesforce Flow Builder is a great way to automate communication and enhance your workflows. Whether you’re sending invoices, reports, or any other type of document, this feature ensures that your recipients get the content they need without you having to manually attach files every time.By following the steps outlined in this blog, you can easily implement email attachments in your flows, streamlining your business processes and improving the overall efficiency of your organization.

Satyam parasa
Satyam parasa

Satyam Parasa is a Salesforce and Mobile application developer. Passionate about learning new technologies, he is the founder of Flutterant.com, where he shares his knowledge and insights.

Articles: 31

Leave a Reply

Your email address will not be published. Required fields are marked *