Email-to-Lead Using Salesforce Flow – Complete Guide

In Salesforce, we have the Web-to-Lead option. Using it, we can create records of leads, but using Flow, we can also automate the process of creating Lead records from Email.

In this Salesforce tutorial, we will learn what email-to-lead is and how to create leads records from Email-to-Lead Using Salesforce Flow. The tutorial includes a real-time scenario and step-by-step explanation.

  • Web-to-Lead: In Salesforce, web-to-lead is a feature that allows the user to capture lead information directly from the Website and automatically create new leads in Salesforce.
  • Email-to-Case: An Email-to-Case is Salesforce is a feature that allows the user to capture Case information directly from the Email and automatically create new leads in Salesforce.
  • Email-to-Lead: We don’t have an email-to-lead feature in the Salesforce Org. We will create an automation that allows users to create a lead by sending an email to a specific email address.

Let’s take a Scenario while working as a Salesforce Admin for a US-based Organization that provides software solutions. I was assigned the task of implementing email-to-lead for an organization so that when users send emails to xyz@gmail.com, it will automatically create a lead in Salesforce and assign the same user who sent the email.

We can use the Email-to-Lead feature by using Salesforce Flow to create the Leads records through Email.

Email-to-Lead Using Salesforce Flow

Using the above scenario and the following steps, we can create lead records from email to lead using Salesforce Flow.

Approach to Create a Flow:

First, we will create a Case through an Email(Email-to-Case), and then, using the case record, we will map the case fields with the Leads fields, and will delete the Case record.

Start Flow -> Record Trigger Flow -> If Case Origin = Lead -> Create Lead from Case -> Delete Case -> Stop.

Prerequisites:

There are some steps that you have to follow before start creating the Flow.

See also  How to Create a Case Related to an Account using Flow in Salesforce

1. Add a “Lead” value to the Case Origin field in the Case object.

Setup -> Object Manager -> Case -> Field & Relationship -> click the Case Origin field -> click on the New button on Case Origin Picklist Values -> add “Lead” -> Save.

Email to Lead Using Salesforce Flow

2. Add an “Email” value to the Lead Source field in the Lead object.

Setup -> Object Manager -> Lead-> Field & Relationship -> click the Lead Source field -> click on the New button on Account/Lead Source Picklist Values -> add “Email” -> Save.

3. Set up Email-to-Case for case origin lead. You should know about Email-to-Case that you have read the following article:

4. Set forward email from xyz@gmail.com(Your Email) to the email service address. For that, copy the Email Service Address and paste it(Your Mail) Settings to Forwarding and POP/IMAP.

The email address that you provided to the case will be our recipient email at every time.

Email to Lead Using Salesforce Flows

Now, we will create the following elements in the flow according to the flow diagram displayed in the following Flow Diagram.

Use Email to Lead Using Salesforce Flow

1. Create Record-Triggered-Flow:

5. Log in to the Salesforce Org. -> Click on the Setup -> Home Tab -> In Quick Find Box, Search for Flows. You will see an option under Process Automation -> Click on Flows.

Then, click on the New Flow button to create a new flow.

6. The Lead record will be created from the Case record is created. For that, we have to select the Record-Trigger flow. Then, click on the Create button.

7. As we want to create leads before we have to create a Case, the flow should trigger when we Create a Case record. That’s why I have selected the Case in the Object field. In Configure Trigger, I have selected A Record is Created because when we update the record, the flow should trigger.

Create Lead Records Using Email to Lead in Salesforce Flow

8. Then, we have to Set Entry Conditions, and in the Condition Requirement option, we have to select All Conditions Are Met(AND) because the following conditions should meet the criteria.

See also  How to Call a Flow From Button in Salesforce | How to Launch Flow From Button in Salesforce

Here, the flow has to trigger only when the Case Origin = Lead and Case Priority = Medium.

9. We are going to create a Lead record from email, so we have to select Optimize the Flow for Action and Related Records.

Create Lead Records Using Email to Lead in Salesforce Flows

2. Get Records(Get User Id):

10. Then, we need to fetch the User details to assign a user to the lead record, which we will create. For that, we need to select the Get Records element by clicking on ‘+ Add Element‘ and enter a Label and API Name into it.

In the Object field, select the User object. Then add the condition as follows:

User ID (From User object) — Equals $Record>User>User Id(From Current record flow).

After this, leave the other fields as they are and click on the Done button.

3. Create Records(Create Lead Record):

11. Now, we need to assign a Case Record Field with Lead Record Fields.

Moving on to Email-to-Lead, let’s understand how Email-to-Case captures the data from email and stores it in the case record.

Leads Field Name <-<- Case Fields
CompanyCase Subject
DescriptionCase Description
EmailWeb Email
LastNameWeb Name
Lead SourceEmail(Picklist Value)
OwnerIdFrom(Get Record) UserId

12. So here, we need to select Leads in the Object field. For that, add a Create Record element and enter a Label and API Name into it.

Then select One record to create and use separate resources and literal values to Set the record fields. Then click on the Done button.

Email to Lead in Salesforce Flow

4. Delete Records(Delete Case Record):

13. In the above step, the Lead record will be created using Case fields. After creating the lead record, we have to delete the Case record because it contains different values than the case fields.

For that, add Delete Element by clicking on the + Add Element icon and enter the Label and API Name.

See also  Automatically Assign PricebookId to Opportunities using Salesforce Flow

14. Then, use the IDs stored in the record variable or record collection variable to find records to delete. You will see the option Triggering Case collection. Select it and click on Done.

After creating the lead record, this delete element will delete the case record.

How to Create Lead Records Using Email to Lead in Salesforce Flow

5. Save:

15. After setting up all labels and conditions, click the Save button to save the flow. For that, we need to enter the Flow Label. The API Name will automatically populate as we click the text box. The Description is optional; we can introduce our flow Shortly.

6. Debug & Activate:

16. After Saving the flow, click on the Debug button. Then click on the Activate button; always remember to debug the flow before activating it. It’s good practice to use flow.

Use Email to Lead Using Salesforce Flow

17. After Activating the flow, let’s check how it is working; for that, we have to send an email to the Email that we have set up as a Routing Email in the Email-to-Case.

Here, you can see I have entered the recipient email as routing email, subject, body, and send email.

Create Lead Record Using Email to Lead in Salesforce Flow

18. Now, the Email that we sent will create a Case, and using case fields, we have created a lead; you can see below the Lead record has been successfully created with fields that we have mapped in the created record element.

How to Create Lead Records Using Email to Lead in Salesforce Flows

This is how we can use the Email-to-Lead feature by using Salesforce Flow to create the Leads records through Email.

Conclusion

I hope you have gotten an idea about how we can use the email-to-case feature to create Lead records. In this article, we have seen features for creating Cases and Leads. We have also seen how to use the Email-to-Lead feature by using Salesforce Flow to create lead records through Email.

You may like to read: