Global Search returns 0 results in a module when i put a custom field

I’m running version 7.11.15.
I’ll recreate step by step what i’m doing to add a custom field to the global search:

  1. Go to /var/www/suitecrm/custom/Extension/modules//Ext/Vardefs

2.Open the php file of the custom field you want to add to the global search (it appears automatically when you create the field in suite).

3.Add the line
$dictionary[‘aecrm_leads_crm’][‘fields’][‘name’][‘unified_search’]=true;
or put it to true if it’s false.

4.Go to /var/www/suitecrm/custom/modules//metadata

5.Open SearchFields.php and add
‘NAME OF THE FIELD’ =>
array (
‘query_type’ => ‘default’,
),

  1. Do a Quick Repair in Suite.

This works in some modules.
I have a module called Leads and doing these steps i can make it search by the field ‘name’ but i have a custom field and i want to search by that field too.

When i add this custom field in SearchFields.php and do a Quick Repair then the global search always returns 0 results for this module but when i go back and delete the lines that i added in SearchFields.php it returns to normal and searchs only by name.

make sure you have added the correct system field name. eg. mycustomfield_c not mycustomfield.

Yes, im using the correct name. It works in another module i have, Im just repeating the process. I don’t know why this time it doesn’t work.

May be try this

I will try this but i don’t thing that’s the issue.
As I said it’s when i modify the SearchFields.php to add the new field it returns nothing. It’s like when it tries to execute this php it breaks or something.

To add to the topic now i see that this only happens when I try to add a related field to SearchFields.php.
When i add a text or number field it works fine.