Though I use Captcha and reCaptcha, I have a lot of dummy users and Contacts which I can identify by the fact that their sort_name = display_name = email (or sort_name contains an "@").

How can I delete those Users and Contacts ?

My original idea was to create a Dynamic Group of those, then delete them after exporting their list to excel to delete the relevant Users. But, how to create such a Dynamic Group (based on what search criteria ?) ?

An alternative would be to create a View (filtered on "sort_name contains '@'"), then use VBO to add them to a Group : I tried, but could not succeed).

I tried using the Search Builder, but it is broken : I have openned a new post for that : Search Builder is broken (Civi 5.4.0 / Drupal 7.59)

2 Answers 2


You could use Search > Search Builder and search for Individuals whose First Name and Last Name are NULL (when this is the case, Civi will use the email address as the Display Name), select all of the search results and then create a Smart Group. You would then periodically review the contacts of the smart group by navigating to Contacts > Manage Groups and then clicking on the Contacts hyperlink to the right-hand side of the group and perform the desired actions.

enter image description here

  • OK, but ... my Search Builder is broken : I don't have any "Select field", but only "Select Record Type" and "Operator" (runnning 5.4.0) : you can reproduce this bug on the demo configuration (civicrm.demo.civihosting.com, in 5.0.0), this way : Search Builder > Select "Individual", then go to Support > About CiviCRM, and then back : "Select Field" has disappeared : I have the same situation, but directly, without this forth and back operation. I will edit my Question to be more precise. Commented Sep 13, 2018 at 13:08
  • @Jacques-MarieMoranne You should open a separate question about why your Search Builder is broken. Commented Sep 13, 2018 at 14:44
  • Jon : OK, done : civicrm.stackexchange.com/questions/26511/… Commented Sep 14, 2018 at 8:00
  • Any other solution than Search Builder ? Commented Sep 14, 2018 at 8:01
  • The only other way to search on NULL values other than Search Builder would be to use the API explorer which might be a bit more complex if you do not have a good understanding of the Civi DB structure. You will find documentation HERE: docs.civicrm.org/dev/en/latest/api Commented Sep 14, 2018 at 18:04

You can use Search Builder to make Smart Group for contacts where Sort Name like @ and First Name null

Name or Email LIKE - '%@%' ...AND... First Name Is Null ...AND... Contact Type = Individual

But I would then use VBO myself so that you can delete any Drupal users that are orphaned (ie no longer have a related civi contact)

We built a View to do this which I can fire through to you if you have trouble creating it from scratch. Ping me in redmine (gratis)

Your Answer

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

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