Filter for global search

is it possible to filter Lead values in the global search, hiding records that have ‘Converted’ value in the Status field?
Using Studio seems to me you can’t do

You could do that with this enhancement

which I never made a PR for :man_shrugging:

1 Like

in ‘/custom/modules/Leads/metadata/searchdefs.php’ I entered:

‘whereClause’ => “AND (leads.status <> ‘Converted’)”,

precisely in

$ searchdefs [‘Leads’] =
array (
‘layout’ => (

‘whereClause’ => “AND (leads.status <> ‘Converted’)”,
‘templateMeta’ =>
array (…)

I did the repair operation.

But the filter doesn’t work… did I put it in wrong?

Hi PGR, it works, I missed to add the code to the modules/Home/UnifiedSearchAdvanced.php file too. :smiley:

Is there any way to make this change secure for upgrades?

1 Like

I think the best would be for this enhancement to go into core…

Do you mean that for now it is not possible to restore the modification to the UnifiedSearchAdvanced.php file in /custom/?

It might be, I didn’t try it, to be honest.

Tell me how it goes

Hello PGR,
I think it can’t be done… I asked on a similar post ( ) and it seems you can’t extend the functionality…
You’ll have to insert it in the coree when I update it, I’ll have to remember to reload the changes… :pensive:

Hi @web_elinet
Upgrade safe
Copy these files:

  • modules\Home\UnifiedSearch.php
  • modules\Home\UnifiedSearchAdvanced.php
    in this file:
  • modules\Home\UnifiedSearch.php
    line 54 (ish)

I have a PHP switch case based on a value in records and current user profile that goes an extra level beyond security groups.

I added the switch case variables and the ‘whereClause’ to the module searchdefs and
viola, search restricted based on current user values.