Search Kit for CiviCRM
On August 13, 2021, Tadpole hosted a virtual Lunch and Learn where Kevin Cristiano gave an update on the progress of the CiviCRM Search Kit. Now under development by the CiviCRM core team, Search Kit expands and improves upon the search experience for CiviCRM admins. (Search Kit is community funded; the primary funder is Wikimedia Foundation.)
Below is the full recording of the session, followed by a brief summary of the demonstration.
Current ways of searching CiviCRM
- Find Contacts: a very basic search with few options.
- Advanced Search: better, but you’re limited in terms of how many operators you can use so you can’t, for example, run a search to find everyone in the United States but not in New York.
- Search Builder: not a very intuitive interface, and although you can use it to build more complex searches it still has some gaps.
- CiviReports: great in that you can pull data from multiple sources, but you’re locked into whatever original data fields/columns were selected by the report’s creator to display and/or filter on.
Search Kit was created to provide better options.
Introducing Search Kit
This demo uses a version of Search Kit that shippis with CiviCRM 5.42, which was rleased in Early October 2021.
Instead of building a one-time, ad hoc search (like the ones we build using Advanced Search) we’re going to build a Search that we can use and modify at run-time depending on our current needs.
Example 1: Contact Search
In this example, we’re searching a number of different database tables to return Contact data. But we want more than basic data; we also want to pull information on the Contact’s spouse, their email and street addresses, and any contributions they’ve made. When using Price Sets, we can even get itemized Contribution Line Items.
Setting the Group By field to “Contact ID” provides a more consolidated view of the data. We’re also changing the Line Item Totals from “List” to “Sum.”
Here’s what we get back:
If we want to return only those Contacts that contributed more than $500, we can add a WHERE clause:
We can also add new fields/column headings to our search results (including Custom Fields) by clicking the “Add” button to the right of the column headings.
Displaying Search Kit Data
Before sharing this Search Kit with our CiviCRM users we first want to tidy up our display. The out-of-the-box column headings are unwieldy, reflecting the table and field name; we want shorter, more descriptive column headings! We select Display, Table so we can re-name and re-order our columns.
We can also Enable Actions if we want to allow users to act on selected Contacts. This should be familiar from Advanced Search.
To share this Display with our CiviCRM users, we want to give them a standalone admin page with a dedicated URL. We do this by adding a Form from the main Search Kit Screen.
Here we can add a title, description, and create a page for our users:
Using Form Builder to Create Search Fields
Now that we have a Form, we can edit it to create search fields.
In addition to the rich content element that we added for our page title, we used the search box to add two fields not displayed in our result set: Contact Last Name and Country. Just Drag and drop to position the elements on the form.
Drag and drop to position the elements on the form.
Example 2: Payment Search
Our next example demonstrates how to search for Payments, using the same method that we did for The Contacts search but this time searching for Contribution Financial Transactions. If your organization uses a payment processor to accept donations, membership fees, etc., searching for the Financial Transactions will allow you to access the Transaction ID and all associated data.
We won’t replicate all the steps outlined in Example 1 here, but you can reference the video starting at 17:35. The Form Builder is used to create a more robust search form than the one in the previous example, and one additional feature was demonstrated: we can allow for inline editing of any field from the Display Table screen, in this case, Check Number. Now if our CiviCRM user has the proper permissions, they can run the search and edit the Check Number field directly within the result set.
You can also add your saved Search Kit searches to your CiviCRM Dashboard (20:45).
Example 3: Contribution Details on Contact Summary Page
We demonstrate how to include a Search Kit search as a block on a Contact Summary page by checking the appropriate box on the Form Settings (22:30).
Search Kit knows to return only the contribution data related to this particular contact so we can create targeted searches and put key information on the Contact summary page, for example, any Events our contact may have registered for. If we’ve enabled Actions on any of our searches, then we can update this data directly from the main Contact summary.
Example 4: Searching Line Items
(25:30) Price Sets are typically used when we want to break payments into itemized line items; for example, if we’re fundraising for a particular program but we also want to solicit an additional donation to our general fund on the same form. The problem is trying to find individual Price Set line items using Advanced Search: you can’t.
Search Kit solves this. We demonstrate how to set up a search where we want to return Contribution Line items; we also want to include any recurring donations.
Populating Smart Groups using Search Kit
Search Kit can be used to populate Smart Groups, too (29:00). We walk through using the Add button to create the Smart Group, then give it a Title and check the Mailing List box to indicate the type of Smart Group we want.
Now we have a list of everyone who has donated to us and the Smart Group will be updated with any new donations. If we want to specifically target folks who made recurring donations, we keep it in the WHERE clause.
In another example, we showed a Smart Group added to a Participants Search, so we can engage with any contacts who Registered or Attended an Event.
With Search Kit we now have a better into our CiviCRM data; we can see not only who has contributed, but how much and what for.