Capture Lead - Already in System?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ategenkamp
    Junior Member
    • Mar 2021
    • 26

    Capture Lead - Already in System?

    I'm using this on a webform to capture a lead and it works great to capture a lead, but if the lead is already in the system, how do I update that lead? I'd like to add a comment or just append to the description of the lead in Espo if they're already in the system but right now it just doesn't do anything.

    Code:
    require_once(__DIR__.'/EspoApiClient.php');
    $client = new EspoApiClient($url);
    $formData = [
    'salutationName' => $data['user_salutation'],
    'firstName' => $data['user_first'],
    'lastName' => $data['user_last'],
    'accountName' => $data['user_organization'],
    'title' => $data['user_title'],
    //'phoneNumber' => $data['user_phone'],
    'emailAddress' => $data['user_email'],
    'description' => '(ID#'.$data['geoid'].')',
    ];
    $client->request('POST', 'LeadCapture/' . $apiKey, $formData);
  • item
    Active Community Member
    • Mar 2017
    • 1476

    #2
    Hi,

    try to add :
    'duplicateCheck' => true

    maybe that's do what you search
    duplicateCheck search on emailAddress or phoneNumber
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    • rabii
      Active Community Member
      • Jun 2016
      • 1250

      #3
      Hi,

      As item said you can set updateDuplicateCheck to true on recordDefs but i am not sure if that would work with API. read this https://docs.espocrm.com/development...d-while-update

      Otherwise instead of making the post request to the CRM you could firstly make a get request to check if a record exist in the database, if it exists then you can make a request to update the record returned (lead). check out these links below has all info you need to make it work:

      https://docs.espocrm.com/development...rams/#examples
      https://docs.espocrm.com/development...rud-operations
      Rabii
      Web Dev

      Comment

      • item
        Active Community Member
        • Mar 2017
        • 1476

        #4
        Hello rabii,
        i respond with my knowledge..
        i have just see this : https://github.com/espocrm/espocrm/b...pture.php#L702

        Maybe
        If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

        Comment


        • rabii
          rabii commented
          Editing a comment
          Interesting, this might solve his problem.
          thanks for sharing
      Working...