Multi-Step Lead Capture

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bernhard
    Member
    • Jan 2019
    • 46

    Multi-Step Lead Capture

    Hi,

    I want to set up a lead capture with 2 or more "pages". After the first page (name, address, email, etc) I want to ask people what products they are interested in. There is a chance that leads would stop after the first page, so I want to store the lead as soon as possible. My setup works fine, however, a lead cannot be updated with the information from the second page. So after my first page, my lead is stored. After the second page, I submit the lead again (with more information). When I switch "Double check" off, I get a second lead with all information. When I switch "Double Check" on, the information from my 2nd page / submit is not stored.

    So, I would need to find a way that I could update an existing lead with more information.

    Any idea how this could be done?

    BTW: I also could use the Business Process Manager I guess? There I would try to find my second lead and then delete the first lead?


    Thanks,


    Bernhard
  • lazovic
    Super Moderator
    • Jan 2022
    • 809

    #2
    Hi Bernhard,

    I'm not sure if this request is relevant to you, but I'll provide information on this request just in case.

    For such functionality, so that the information for the lead is updated and the lead itself is not duplicated after it gets to the second Lead Capture form, you will need to create a workflow (Advanced Pack extension feature), which will search for the lead and update information about it depending on the information received.

    Such a workflow is shown in the attached screenshots. If the second Lead Capture form receives data about an existing lead, workflow will update information only for the Title and City attributes (the formula can be supplemented in a similar way, depending on the attributes that your Lead Capture form accepts).

    Click image for larger version

Name:	Screenshot from 2024-09-12 16-44-04.png
Views:	89
Size:	42.0 KB
ID:	110220
    Click image for larger version

Name:	Screenshot from 2024-09-12 16-49-00.png
Views:	49
Size:	45.0 KB
ID:	110221

    The formula script that was used in the Execute Formula Script action:
    Code:
    $data = json\encode(data);
    
    // Retrieve Title attribute value from the data transferred from Lead Capture
    $title = json\retrieve($data, 'title');
    
    // Set Title attribute value for an existing lead
    if ($title) {
        record\update('Lead', targetId, 'title', $title);
    }
    
    // Retrieve City attribute value from the data transferred from Lead Capture
    $addressCity = json\retrieve($data, 'addressCity');
    
    // Set City attribute value for an existing lead
    if ($addressCity) {
        record\update('Lead', targetId, 'addressCity', $addressCity);
    }
    
    // ...
    // Repeat for any attributes you need
    More about workflows you can find here: https://docs.espocrm.com/administration/workflows.
    More about the formula script you can find here: https://docs.espocrm.com/administration/formula.​

    Comment


    • Bernhard
      Bernhard commented
      Editing a comment
      Thanks a lot, I appreciate your input and your description and code helps to learn about Espo CRM.
Working...