1

Is there a way to prevent a new contact from being created if the email already exists with another contact?

When a new contact is added, if the email already exists, I would like an error saying that contact can not be created because email already exists.

Thanks

UPDATE: So to add further details about my question...

OTHER AREAS LIKE EVENTS One of the comments below stated "if an existing contact tries to use a registration form do you allow or disallow that record to be updated?". So I am not sure exactly how CiviCRM works, but in this case above, I would want the existing contact information to be used, and would not want a new contact created. So I do not want to prevent updating of existing records, I would just want to prevent a duplicate contact with a duplicate email as being created. This particular scenario is probably something I will come across in the near future as we move forward with CiviCRM implementation, but is currently not an issue I have to deal with (yet).

IMPORTING I did notice that when I import contacts, I can choose DeDupe rule of EMAIL (RESERVED), and this will correctly skip importing any contact if the email already exists. So this is solved and is not an issue.

MANUAL ADDING CONTACT When manually adding a contact though, I am unable to prevent a user from adding a new contact with a duplicate email. I see there is a button that says CHECK FOR MATCHING CONTACT(S) ... If the EMAIL (RESERVED) rule is set to Unsupervised, then click this button does not find a match (even when one exists). If I change the rule to Supervised, then clicking the button will find a match. However this is still not the functionality that I want, as it still does not prevent the user from adding the contact if they either forget to click the CHECK FOR MATCHING CONTACT(S) button or if they choose to ignore the message that it found a match... This is

So what I want to be able to do, specifically for Manually Adding Contacts, is that when the SAVE button is clicked it will just give an error message saying "Contact Email already exists. Can not add new contact", or "Contact Email already exists. Would you like to add it anyways?"

I looked at CiviRules but did not see how I can implement this using that module.

5
  • Do you want to prevent new contact via the front-end (eg event signups, memberships), or back-end admin GUI, imports, API etc? What about if someone tries to change or add an existing address to a different existing contact?
    – Aidan
    Jan 10, 2022 at 11:24
  • @aidan - My initial use case (as I am new to CiviCRM) is backend, but now that you ask the question, I want to prevent duplicate email in all cases that you mention (new contact from both front end and back end as well as if somebody tries to change their email and it already exists.)
    – jsherk
    Jan 11, 2022 at 13:16
  • skim read. is it possible to have your team instead use a Profile for 'add new contact' instead of using the inbuilt one. then, i think, it will apply the unsupervised rule and you can set profile to "Issue warning and do not save"
    – petednz - fuzion
    Jan 22, 2022 at 22:15
  • @petednz-fuzion I am very new to CiviCRM so I will have to investigate what you mean by using a Profile to enter a contact ... that sounds like that could be a solution.
    – jsherk
    Jan 23, 2022 at 2:32
  • Go to Customise > Profiles. You will see a Reserved Profile tab, which is where the existing 'New Individual' profile will show. You can just make yourself a new one and set the rule to apply.
    – petednz - fuzion
    Jan 24, 2022 at 18:58

2 Answers 2

2

You probably want to reconsider what you want. Having unique email addresses is generally a good thing, and CiviCRM can be set up to help you keep them unique. But there are good reasons that this is not hard-wired as you'll probably discover.

If duplicate emails are getting created that are not what you want, then you probably want to review how that is happening and fix that particular workflow. For example, it might be an employee that is importing contacts without using the dedupe option. Or it might be a registration form that is not configured to dedupe on creation. etc.

In theory, your "supervised" dedupe rule should kick in when an administrator tries to create a new contact with an existing contact's address, but my experiment wasn't successful in testing this theory. If this is working as designed, then you could just update your supervised rule.

But, even without this, you should see super useful messages pop up as you create a new contact using the admin interface, showing potential duplicates.

Perhaps that functionality is not working? Or you might need some training so that you notice it?

A hard "never create contacts with duplicate email addresses" is almost surely going to create new and gnarlier challenges (e.g. if an existing contact tries to use a registration form - do you allow or disallow that record to be updated?).

For completeness, and to answer your question: the civirules extension would likely allow you to create a rule such as you are describing. Caveat Implementor!

4
  • 1
    "CiviCRM is setup by default to keep them unique". not sure i would put it like that. certainly i don't think of it as being thus. i agree a Supervised matching rule can flag these, but if a public facing rule was First + Last + Email, then civi does nothing to prevent multiple contacts with the same email. (and not sure that using the matching rules that come with civi does prevent this in all situations) The CMS on the other hand will, so if contacts were only added via Profiles with 'create user' then duplicate emails could/should be prevented but isn't what the OP is after
    – petednz - fuzion
    Jan 12, 2022 at 0:49
  • I am aware on how to import contacts and use the de-dupe rule. What I want to prevent is the creation of a new contact where the email already exists with another contact. If there is supposed to be a setting that prevents this from happening, then that is all I need. But with new install of CvivCRM, I can add a new individual contact with an email that exists for another individual contact, and it does not give me any kind of warning or notice... it just creates the new contact. I will look at civirules extension. Thanks
    – jsherk
    Jan 12, 2022 at 20:57
  • Okay, fair comments, I've updated my answer. In the not-to-recent-past, the 'supervised' rule was supposed to warn administrators if they were going to create a contact with an existing email address, but my tests failed to reproduce what I thought would/should happen. Again, hard-coding unique email addresses as a global rule is likely to generate new problems, so I strongly recommend that you focus on workflow-specific solutions.
    – Alan Dixon
    Jan 17, 2022 at 17:40
  • @AlanDixon You have click on the CHECK FOR MATCHING CONTACT(S) button first if you want to check for duplicate emails. If the EMAIL (RESERVED) dedupe rule is set to Unsupervised, then it will NOT find a match. If it is set to Supervised, then it will find a match. However this does not prevent the contact from being added in anyway (see my UPDATE to my question above).
    – jsherk
    Jan 22, 2022 at 18:07
0

Thanks for this information. One of the worst issues with NationBuilder is that email addresses are unique. This is fine until one has to manage partners who use the same email address. This is not uncommon for married couples, especially seniors.

1

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.