Let’s Build an Email-to-Lead from Scratch (Part 4)

This series of posts will walk you through the steps of building an Email-to-Lead process from scratch leveraging Email-to-Flow. If you are unfamiliar with Email-to-Flow, take a minute to review Introducing Email-To-Flow, a low-code Email Service.

This series of posts are iterative, layering in functionality piece by piece so you can fully understand (and enhance as required) the complete solution. If you not interested in build the Email-to-Lead piece by piece, no problem. The completed Email-to-Lead template is included in the package.

Let’s build an Email-to-Lead from Scratch (Part 1) – Email Ingestion

Let’s Build an Email-to-Lead from Scratch (Part 2) – Store the Email

Let’s Build an Email-to-Lead from Scratch (Part 3) – Email Threading

Let’s Build an Email-to-Lead from Scratch (Part 4) – Processing Attachments

Part 4 – Processing Attachment

Part 4 begins where Let’s Build an Email-to-Lead from Scratch (Part 3) left off.

In Part 4, we process email attachments.

In this example, we are linking email attachments to the email message record. Similar to our Email-to-Case flow, you have the ability to override this decision at any point. For example, maybe you want to store email attachments at the lead level.

Update the Flow

Open you flow and simply reconnect the If Content Versions Populated, Create Content Versions, and Create ContentDocument process steps you originally copied from the Email-to-Case template.

Your flow should look a little something like the following.

Save the Flow version and activate.

Update the Email2Flow Custom Metadata type

Update the CMDT created in Let’s build an Email-to-Lead from Scratch (Part 1).

Check Accept Text Attachments and Accept Binary Attachments.

Save the CMDT.

Update the Email Service

Update the Email Service created in Let’s build an Email-to-Lead from Scratch (Part 1). Set Accept Attachments to All.

Save the email service.

Let’s Test

Let’s create a new email. This time will an image.

Sweet! There it is.

Reviewing the lead that was just created, we can navigate to the Email Message record and view the email attachment.

That’s it.

That’s it, in 4 easy steps we implement an Email-to-Lead process.