Filter for global search

Hi,
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

Hi PGR,
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/?
:nerd_face:

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 ( https://community.suitecrm.com/t/how-to-override-email-module-file/68260/5?u=web_elinet ) 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
    to:
    custom\modules\Home
    in this file:
  • modules\Home\UnifiedSearch.php
    change
    line 54 (ish)
    require_once(‘modules/Home/UnifiedSearchAdvanced.php’);
    to
    require_once(‘custom/modules/Home/UnifiedSearchAdvanced.php’);

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.