1

We have a custom field - 80% of our contacts have this custom field in their profile - the rest are blank.

We setup a rule - if 7 characters or more of the custom filed are a match - it meets the threshold - however - contacts with blank custom fields are coming up as possible duplicates. Why is that?

Latest Civi - Drupal 7.

1 Answer 1

2
+50

It's coming from line 179 in CRM/Dedupe/BAO/Rule.php, but it looks as if it's been like this forever so I'm not sure if there's a reason.

If you change line 76 where it sets $on to be the below code instead, it makes it work but I can't immediately see if that has any side-effects for other types of rules.

    $on = [
      "SUBSTR(t1.{$this->rule_field}, 1, {$this->rule_length}) = SUBSTR(t2.{$this->rule_field}, 1, {$this->rule_length})",
      "t1.{$this->rule_field} IS NOT NULL",
      "t1.{$this->rule_field} <> ''",
    ];

Note that dedupe checking caches results, so after you make that change clear cache at admin - system settings - cleanup caches.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.