40 thoughts on “Email-to-Lead with the Help of Salesforce Flow

  1. What If I had to parse through the email and add specific details to the lead using your flow process. Like I had a bunch of details like the company name, contact, country, product name and I wanted to add it all in the lead details. How Should I do that?.

    1. Rakesh Gupta – Mumbai – 9x Salesforce MVP | Senior Solution Architect | 8x Author | 5x Dreamforce Speaker | Salesforce Coach | Co-host of AutomationHour.com and AppXchangeHour.Com

      Your best options are to use Email Services (1) or an Apex Class with Flow (2) to parse the inbound email and extract all the details.

    1. 1. Ensure you’ve designed the Flow correctly and Activated it.
      2. Last option is to use Debug Log to find out why it is not working.

  2. Hi Rakesh,
    Email to lead is working for me as per your approach.
    But my user case is a bit different:
    I have two different email service address ( example: abc@gmail.com and xyz@gmail.com) for email to case routing information and if someone sends email to abc@gmail.com then case should be assigned to abc queue and if someone sends email to xyz@gmail.com then case should be assigned to xyz queue. Based on this in same way lead also should be assigned.
    Can you please help me?

    1. For case assignment use “Email-to-Case Routing Address” configuration.
      One possible solution – For lead assignment use Async Path in Record-triggered Flow, grab case owner Id and use it when creating lead.

  3. I am able to get the desired result of this but for our business case we email through the lead. I want the email that created the initial case to be related to the new lead. I was hoping I could just update the RelatedTo field on the email message but found out that will not work. Any thoughts or suggestions?

  4. Excellent guide worked great. It fits my current business case perfectly much appreciated. If it becomes used more i may have to edit it slightly to accept from any email address.

  5. Thanks for sharing this approach. Might consider trying it out but it seems to me that one of the key elements of a created Lead, the email address, is missing on the Lead. How can that be parsed from the initial email or the created Case and auto populated? Or perhaps I missed that in the tutorial? If not possible, then this solution requires manual intervention on every Lead that is created before it can be included in a Campaign.

    1. Use SuppliedEmail from Case

  6. The leads are generating if we send email from the email id that is a user in SF, when trying to send email from another email id that is not present as a user in SF then I am getting error “This error occurred when the flow tried to create records: INVALID_CROSS_REFERENCE_KEY: Owner ID: owner cannot be blank. ” how can this be resolved?

    1. Rakesh Gupta – Mumbai – 9x Salesforce MVP | Senior Solution Architect | 8x Author | 5x Dreamforce Speaker | Salesforce Coach | Co-host of AutomationHour.com and AppXchangeHour.Com

      I wrote the blog post for allowing Sales Rep to Send emails to create leads via email-to-case. If you want to let any random email generate leads, you have to modify the logic.
      – Add a decision element if Salesforce is unable to find a user, then
      – Assign the lead to some other user.

  7. I have done all the steps, case is getting created but the lead is not generated, while debugging I am getting this error “The triggering record didn’t meet the condition requirements, so the flow didn’t run.”

  8. FlowApplication
    3:50 PM (0 minutes ago)
    to me

    Debug the failed interview in Flow Builder.
    Error element Create_a_Lead (FlowRecordCreate).
    This error occurred when the flow tried to create records: INVALID_CROSS_REFERENCE_KEY: Owner ID: owner cannot be blank. You can look up ExceptionCode values in the SOAP API Developer Guide.

    1. Rakesh Gupta – Mumbai – 9x Salesforce MVP | Senior Solution Architect | 8x Author | 5x Dreamforce Speaker | Salesforce Coach | Co-host of AutomationHour.com and AppXchangeHour.Com

      Make sure to assign the valid owner to the lead record. Second, make sure the sales rep (who has an account in Salesforce) sends the email, not a random person.

  9. Hi Rakesh…GREAT tutorial. I built this without the schedule path (since it’s 0). Everything else is the same. However, the delete is executed before the lead is created, thus causing a flow error. I had to add a schedule path to delay the delete by 1 minute. Any idea why that is?

    1. Yes, now it is possible to implement it using Flow. Is it possible for your to share the flow screenshots?

  10. I am trying to do this. but its not working with this message below:
    These issues prevent activation.
    Before you can activate a flow that contains scheduled paths, specify the default workflow user in your org’s process automation settings. Then save your flow again and activate it.

        1. Rakesh Gupta – Mumbai – 9x Salesforce MVP | Senior Solution Architect | 8x Author | 5x Dreamforce Speaker | Salesforce Coach | Co-host of AutomationHour.com and AppXchangeHour.Com

          Look for Process Automation Setting

            1. Rakesh Gupta – Mumbai – 9x Salesforce MVP | Senior Solution Architect | 8x Author | 5x Dreamforce Speaker | Salesforce Coach | Co-host of AutomationHour.com and AppXchangeHour.Com

              Please share the screenshot

              1. wow. it is working now~~. I guess it took a while to apply what I setup.

                Thank you for your help. Rakesh Gupt.

                Chris.

                ps. do you have any email or trailhead that I can follow you?

                1. Rakesh Gupta – Mumbai – 9x Salesforce MVP | Senior Solution Architect | 8x Author | 5x Dreamforce Speaker | Salesforce Coach | Co-host of AutomationHour.com and AppXchangeHour.Com

                  Wow. I am glad to know that it works.

  11. Hi Rakesh

    I have created a flow and a process builder. Every thing works fine till the time I am not deleting the case record. The moment I try to delete the case record ,nothing works.

    Please help me.

    1. Here you go

      1. Create a process on case object and look for Type=Lead
      2. Pass the case record id to Flow
      3. Use Flow to delete the record

  12. Nice tutorial and work around for email-to-lead

    I have a doubt, how can i pass the id of the case to the flow from workflow rule so that the flow will get executed for that particular case only?

    1. I’m glad you liked it 🙂

      First, create a variable in flow VarT_CaseID
      Then modify the custom button URL to pass the case record ID to it, as mentioned below

      /flow/case_to_email?retURL=00Q&{!VarT_CaseID}={!Case.Id}

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Exit mobile version
%%footer%%