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

  1. 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.

  2. Can you Share the blog regrading : – Add a decision element if Salesforce is unable to find a user, then
    – Assign the lead to some other user.

  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.

  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. 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.

  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?

  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. Thank you for the reply. I have already done it. but it keep saying that I cannot bring any userid from the begining. Could you let me know?

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

                Thank you for your help. Rakesh Gupt.


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

  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


Leave a Reply

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