Enable Searching Contacts and Companies by Custom Field Values Without Field Alias Prefix

Problem Statement:

Currently, Mautic’s search functionality only allows users to search for contacts or companies directly based on the values saved in custom fields, specifying the field alias and a colon (e.g., client_id:my-client-id).

User Story

As a user,

I want to search for contacts and companies directly using the value saved in custom fields without needing to prefix the field alias and colon,

So that I can quickly locate specific records with a straightforward search query.

I think these groups of people would benefit from this idea:

Mautic User and admin

Why I think they would benefit from this idea:

  • Enhanced Usability and User Experience

Are you willing to work on this idea?:

Yes, I can take the initiative.

Proposed Solutions

  1. New Configuration for Custom Fields:
    Add a “Searchable in Search” toggle in the custom field setup UI.

  2. Update Search Query Logic
    Modify \Mautic\LeadBundle\Entity\LeadRepository::addCatchAllWhereClause and \Mautic\LeadBundle\Entity\CompanyRepository::addCatchAllWhereClause to include aliases for custom fields marked as searchable dynamically.

Searchable in search isn’t great use of grammar, I’d probably use ‘Available in search’ instead?

Here is the supporting PR: Enabling Searching Contacts and Companies by Custom Field Values Without Field Alias Prefix by shinde-rahul · Pull Request #14393 · mautic/mautic · GitHub