This post will walk you through the steps of building an Email-to-Opportunity process 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.
The Purchase Order Use Case
More and more, we are seeing customers require purchase order invoices. Purchase order invoices can reduce fulfillment time, provide better record keeping, improve payment processing, and provide a digital archives of your transactions. This is all great. PO Invoices, however, can also introduce delays in your system. In a Non PO Invoice process, the invoice is simply generated and forwarded to the customer for payment. In a PO Invoice process, a customer’s purchase order must be match to their existing invoice.
Don’t worry, Email-To-Flow has you covered.
For this demonstration, we will be creating an Email-to-Flow process which matches an incoming purchase order email to an Opportunity record.
Let’s build out our scenario
Our favorite client, Test Account, committed to a new deal worth $5000. They informed us that a Purchase Order is required for them to proceed.
No problem. We create an opportunity and generated an email from that opportunity.
When Test Account replies to the email (with their purchase order information), we want to match the email to the opportunity. When attached, we can inform the team to issue an invoice. This will be accomplished with Email-to-Flow.
If you are looking for a detailed step by step guide on creating an Email-to-Flow from scratch, check out Let’s build an Email-to-Lead from Scratch series.
The Email-to-Opportunity flow
Let’s take a look at the Email-to-Opportunity flow.
For demonstration purposes, the flow is stripped down to it’s basic functionality. In your implementation, you may want to include fault paths and addition logic.
Get Oppty from Email Header
The Get Oppty from Email Header apex action attempts to find a matching Opportunity via the email header data. The apex action takes in two parameters: (1) The header variable provided by Email-to-Flow and (2) the name of the object to search.
For this demonstration, we are leveraging the recordExists and recordId return variables. Review the user’s guide for additional return variables that can be leveraged in your specific requirements.
Oppty Match Found Decision
A decision is used to determine if a matching Opportunity was found. For this demonstration, we are only interested in processing matching records.
Create Email Message record
If an Opportunity match was found, an email message record is created.
Create Email Attachments
If the email includes email attachments, they are attached to the newly created email message.
That’s it. In under 5 minutes, you can create an Email-to-Flow process capable of linking emails to your opportunity record.