Search Kit and Aform - two still-beta core extensions for CiviCRM - look really promising. About a year ago I developed a custom search extension called Keenies (it was originally designed to help find keen supporters for mailing segmentation and it's hard to change a name...unfortunately) to do lots of awkward searches that couldn't reasonably be done with existing CiviCRM functionality. Search Kit has the promise to make that redundant, but I couldn't wait a year (or more accurately: my clients wouldn't wait a year!) so I built Keenies as a stop-gap solution, although I have grown quite fond of it.
So 1 year on, do I still need Keenies?
Real world test 1: remove people from one group if they unsubscribed from another
How did we get in this mess? A client had a smartgroup called "everyone we're allowed to email" which simply ruled out those CiviMail will refuse to email (i.e. those without bulk opt-out, or do-not-email). In making a mailing segment, they made a new smart group starting from that, but removing various other groups. However, they then used that secondary smart group as a mailing group. And people unsubscirbed from it at will, the problem being that those people are now still in the "everybody" smart group since they only unsubscribed from the second smart group. (What my client should have done was to start a mailing using the search results of the second smart group, then chosen the "everybody" smart group as the Unsubscribe group.)
With Keenies, it's a very simple search. Choose "Manually added/removed from group", select the group and choose Removed. It then gives me the results that I can use CiviCRM's built in actions on, e.g. Remove from Group to remove the people who unsubscribed from this group, from the other.
With Search Kit? So, first things first, can we identify the people who have unsubscribed from the second smart group?
Search Kit asks me to start with what I want to search for. So I chose contacts. Now I know that the table I want to interrogate is civicrm_group_contact, and that it has an API entity called GroupContact. However I couldn't find a way to access this on Search Kit. The only group-related 'With' option seem to be "Contact Group" - there's two of these and the small print is different: "Group modified by" or "Group created by". I don't think that's what I want. I tried it and then I tried specifying the group with Group Name but it returned zero results. I couldn't find anything else about groups in the options. So I thought I'd try starting from the Group record, and seeing if I could get the Contact from there. The UI wouldn't let me change the Search For drop-down, so I started a new one. This time I started from Groups, however I was stuck at the same point: I could not get to the GroupContact entity.
Conclusion: I can't see a way to do this. I can't even find people in a group with Search Kit.
Real world test 2: Send a mailing to people who have signed one petition but not another
For this example you need to understand that for these purposes signing a petition is a type of activity, with the subject being the name of the petition. We want to send a CiviMail to these people, and use the Newsletter subscribers group for the unsubscribe group.
In Search Kit, the setup looks like this:
Actually, this returned several rows per contact, so I also had to add a Group By contact ID.
Both systems produced the same result: 44,244 records, which is reassuring! Both systems produced fairly performant SQL, returning the results within a second or two is fine.
So Search Kit can do this, which is great! However, I'm not sure my clients would be able to create the query without gotchas (even I didn't, forgetting the GROUP BY): you have to know to select Required for the first join and Optional for the second (a common rookie SQL error is to do an INNER JOIN and then rely on that table's id field being NULL!). While this is understandable to an SQL programmer, it's not obvious to typical users. But the positive case is pretty straight forward and neater in Search Kit than Keenies because it starts without any fields.
There seem to be some bugs in the Search Kit UI at the moment (it's still in Beta and also I'm using it with my Aah theme, whereas it's been designed using Shoreditch). I couldn't work out the relationship between the disabled status of the Search/Auto/Actions buttons; it seems fairly random!
Having got the contacts I want, I now wanted to send a mailing to them. Keenies, being a custom search, offers up all the standard search tasks however Search Kit has a much more limited list; and this does not yet include CiviMail. It does include an Add To Group option, though and / or you can save the search and attach a Smart Group based on it. This still means you then have to view the contacts of the new smart group, select them all and then choose the select CiviMail action. I'd imagine that there are plans to add an action to skip these extra steps.
Conclusion: Search Kit + a bit of faff and some technical training can replace Keenies for this purpose.
Real world requirement: On hold emails
Both search systems offer a way to find people who have at least one not-on-hold email address.
Search Kit: Contacts, with required Email if On Hold = No, Group by contact ID
Keenies: Email, Mode: Has at least one valid email
Find contacts where all their emails are on hold. This means the contacts have emails, but they're on hold.
Keenies: Email, Mode: Has email(s), but all of them are on hold
Search Kit: This took a bit of thinking about:
With Email: required, one of on hold types. i.e. there must be at least one on hold email
With Email: optional, not on hold; add a WHERE this email ID is NULL.
Group by contact ID.
They returned the same numbers. Of course Keenies is much easier to use because it's programmed for this specific use case whereas Search Kit has no such presets. Search kit's generality though is very "powerful" as tech people like to say. Also, I note that Search Kit seems to offer an Un-hold emails action which could be really useful when combined with an Emails search. I believe it should also be possible with Search Kit to provide a search form on top of this, which might be a useful feature.
Conclusion: Search Kit can replace Keenies for this purpose and offers additional features, but you need a more technical level of expertise.
Find people who have had / opened / clicked mailing(s) or not.
Search Kit has no queries for this at the time of writing.
- Keenies has to stay for now to provide searches you can't do with Search Kit at this time.
- Several of the searches can be achieved in Search Kit, and performance is similar (both good).
- Search Kit offers some extra features, but also omits certain features (e.g. being able to CiviMail the search results)
- Search Kit requires a high level of technical expertise and is an abstract/general tool, Keenies provides concrete and simpler criteria based more around specific things that need to get done.
- I look forward to seeing Search Kit develop and plan to revisit this comparison at a later date.