Searching for Non-Primary Data in CiviCRM

2019-03-21 09:17
Written by
lcarter_backoffice - member of the CiviCRM community - view blog guidelines

One of the questions we occasionally get from our clients concerns how users can search for non-primary emails, addresses, and phone numbers in CiviCRM.  Because so many constituents use different emails for different purposes - one for billing, one for bulk emails, and so forth - it can become a challenge to locate people in your data.  However, we have a couple of suggestions for how you can search across all emails, phone numbers, and addresses.

Option 1: Add Them to Your Search Results

By default, CiviCRM is set to search only primary information.  However, this is a very easy thing to change.  Go to Administer > Customize Data and Screens > Search Preferences, and find the option labeled “Search Primary Details Only.”  (See here if you’d like a visual.)  Set that to no, and save.

As a test, I added a contact with two different email addresses. With that search setting defaulted to yes, I searched for the email address boxed in the screenshot, and got no results.  Here is the result with the same search, after changing that field to no.

Note that this change unfortunately does not affect the quicksearch at the top left in CiviCRM.

Option 2: Use the Search Builder

If for some reason you prefer not to change the default search settings, you can also use the Search Builder to search for non-primary emails.  The Search Builder allows you to search for emails (or phone numbers, or addresses) with specific location types, so you can iterate through your non-primary location types to search as many options as you wish. Note that I used the “also search where” option, which essentially sets this up as an OR search: find contacts where home email is x OR where work email is x OR where billing email is x.

Here you see the result.

If you have a significant number of location types, this search option can be somewhat cumbersome.  However, it nevertheless is a good option for finding contact information based on a specific location type (or types).


Filed under


Anonymous (not verified)
2019-03-27 - 13:17

This is really helpful! And if I'm right in understanding your difficulty, there is also a 3rd option, in the  'Full text search'. This allows you to search for any string across a range of tables. It's at Search > Full text search.

Anonymous (not verified)
2019-04-11 - 11:54

We've noticed that toggling this setting to search more fully (as in Option 2) results in our Exports that use Primary fields exporting many "Old" type addresses, failing to accurately select the address record marked as Primary.

When I turn the Search setting back to only search Primary, the exports function correctly. 

If anyone else has experienced this issue or understands a fix please let me know. We were excited to be able to search secondary emails and addresses but can't leave use the setting if it will break our exports.