Announcement

Collapse
No announcement yet.

Duplicate checking

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Hi,
    this checks if there is an email or a duplicate phone, both in the creation and in the modification.
    Let me know if it works.

    PHP Code:
    namespace Espo\Custom\Services;

    use 
    \Espo\ORM\Entity as Entity;

    class 
    Lead extends \Espo\Modules\Crm\Services\Lead
    {
        protected 
    $checkForDuplicatesInUpdate true// set true to enable for update
        
    protected function getDuplicateWhereClause(Entity $entity$data)
        {
            return array(
                    
    'OR' => array(
                        array(
                            
    'phoneNumber' => $entity->get('phoneNumber'),
                        ),
                        array(
                            
    'emailAddress' => $entity->get('emailAddress'),
                    ),
                )
            );
        }

    Comment


    • #17
      added to custom/Espo/Custom/Services/Lead.php

      when I add a new lead with an existing phone number or email a list appears with 20 "similar leads" that have different phone numbers, these are not duplicates and Espo gives an error when updating any unique lead...

      Comment


      • #18
        What kind of error?

        Comment


        • #19
          phone number matching error
          but the phones on which there is an error do not match

          Error 409: {"reason":"Duplicate","data":{"5cfa8085af40309a 1": {"id":"5cfa8085af40309a1","name":"\u0410\u043b\ u04 35\u043a\u0441\u0430\u043d\u0434\u0440 \u041f\u0430\u043d\u0438\u043e\u0442","emailAddres s":null,"phoneNumber":"******4866323","accountN ame ":null},"5cfa8085b3d91fe65":{"id":"5cfa8085b3d 91fe 65","name":"\u0410\u043d\u043d\u0430 \u041a\u043e\u0441\u0430","emailAddress":null,"pho neNumber":"******9481886","accountName":null},"5cf a8085b6a506ce2":{"id":"5cfa8085b6a506ce2","name":" \u041b\u0435\u043e\u043d\u0430","emailAddress":nul l,"phoneNumber":"+380674896113","accountName":nu ll },"5cfa8085b938536e5":{"id":"5cfa8085b938536e5", "n ame":"\u041d\u0430\u0442\u0430\u043b
          ......

          defines as duplicate phone numbers that are not duplicates; in a global search, everything is ok
          Last edited by alexisc; 11-22-2019, 09:49 AM.

          Comment


          • #20
            Going to add a duplicate check on an entity (Property/Real Estate).

            Does anyone know if these code are still relevant and will work as a Duplicator Checker as it been over 1 year (or more depend on which code).

            I know the Contact will check against the name(?), when you try to create. I want to add similar function to a different entity.
            Last edited by espcrm; 03-02-2021, 12:28 AM.

            Comment

          Working...
          X