Using Search Kit in the wild

2021-10-30 03:42
Written by

Over the last year the Core Team have been working hard on Search Kit - a new way of searching and reporting on data in CiviCRM.

Although still in beta, Search Kit is already a very powerful tool. It’s also fast, which makes it particularly pleasing to use. It’s a quietly revolutionary feature.

The work is ongoing, with regular updates and features appearing every week - see the SearchKit Mattermost channel for the bleeding edge work.

This all sounds great, but how well does it work in practice? Here at Humanists UK I recently had to generate a lot of data for a reporting deadline, so I decided to see how much I could do purely in Search Kit.

I was able to do 95% of what I wanted. And I did it far more quickly than I could have using Advanced Search, or by constructing something in Search Builder. Plus I was able to do things that would have taken multiple steps before - or even needed dropping down into Excel. These things simply weren’t possible on one screen.

Then, when our staff saw the kinds of searches I was doing, they actively requested training on Search Kit. Anyone who works in IT will know that this isn’t super common! So I was very pleased with how it turned out. 

Here are some of the more complicated examples:

(Note: all searches are on Civi 5.42 on WordPress, with a couple of layout tweaks courtesy of the excellent CiviCRM Admin Utilities)

Contributions -> Contacts -> Memberships

I needed to find particular contributions over the last two years, and see the membership status(es) of the person who made them.

Pre-Search-Kit this would have been a multi-step process. I’d probably have used Advanced Search to find the people, then dropped them into a group, then searched on that group in Find Memberships. This needs 6 different screens and page requests. It’s ok, but slow and laborious if you’re having to do it multiple times.

In Search Kit it worked all in one go, without a single page refresh:

The key to this was the ‘With’ section. This allowed me to start with a Contribution entity, then link to its Contact entity, and then link to the Contact’s Membership entities. (If you’re familiar with SQL, this is doing left joins behind the scenes.)

I found it best to build this in stages: start with the Contribution search, and make sure it’s finding the correct contributions. Then add the Contact ‘with’, and make sure that’s making sense. Then add the Membership ‘with’. Each time, more fields become available in the dropdowns. If you have a lot of custom data then the dropdowns get quite large quite quickly! So it’s best to take it slow.


In the ‘Where’ section you can drag and drop fields. This includes moving them in and out of sub-groups:

Reporting on Multi-Value Custom Data

We run non-religious ceremonies across the UK (funerals, weddings, and naming ceremonies), and I wanted to build a report showing how many ceremonies had happened in each governmental region in the previous quarter. 

The individual ceremonies are logged as multi-value custom data on an individual’s contact record. And we were interested in the region in which the individual lived.

This kind of multi-value custom data is treated as an entity in itself in the ‘Search for’ box. So I started with this ‘Ceremonies Taken’ entity, and set the appropriate date range in ‘Where’. This gave me a list of all the ceremonies.

I then used ‘With’ to link to the ‘Ceremonies Taken Contact’ Contact entity for the ceremonies - ie. the individuals on whose record the ceremonies were recorded. This meant I could start searching on any contact fields or custom data - including the ‘Political Areas: Regional Authority’ custom field that is part of the Contact entity.

Then, the key: use ‘Group By’ and ‘Field Transformations’ to group the data by both the governmental region and the type of ceremony - and show a count.

I saved this as a Search Display, and voila:

This Display has a unique URL that I can send to staff so they just see the report without all the surrounding Search Kit. The next stage here will be to use Form Builder to allow staff to change the date range without having to go into Search Kit itself - I haven’t quite managed this yet.

Previously I would have (and did) coded a manual quickform page to do the calculations behind the scenes and show the report data. This is far faster.

Relationship searches

We also run a network of pastoral carers, who go into hospitals, prisons, and other institutions across the UK. Sometimes they are paid, and sometimes they’re volunteers. This data is all stored in Civi using relationships.

I needed to create a report showing the list of these volunteers/employees, the institutions they visit, and the type of institution.

Search Kit refers to people with relationships as ‘Contact Related Contacts’. So you start with a Contact search, and then bring in relationships by adding ‘With’ ‘Contact Related Contacts’.

I’ll be honest: this can be a mind-bender. In your dropdowns you will end up with what look like duplicate fields: you’ll have one for the Contact itself, and one for the contact to whom the original contact has a relationship. These appear under different headings in the dropdown:

You need to make sure you’re selecting the correct ones. Again: I recommend taking it slow and one step at a time, and using the ‘Search’ button each time to check you’re seeing what you want.

Once this was working I was able to group by the original contact ID, in order to have one row per volunteer/employee. And I got the report I wanted:

Certainly relationship searches were one of the more confusing areas. That’s just because relationships can inherently get quite confusing! But Search Kit handled everything logically and once I figured out how I needed to conceptualise the data it all came together. This data is now all saved as Search Displays so that staff can see it quickly.

Again, in the past I’d have coded up a quickform page to pull all this data together. So this is a big improvement.


I learnt a lot while putting these searches together. In the last few days I’ve built on these searches, and it’s amazing how fast it all is.

If you haven’t tried Search Kit yet, or if you tried it in the early days and haven’t gone back, I recommend taking a look. It’s certainly going to revolutionise our work.

4 people liked this (login to vote or to comment)


Yes, search kit rocks. I recently used it to search for activities based on the criteria of the source contact while displaying the target contacts as the results. Nice work core team!