Search criteria for relate module finder

Hi, how can I change the default field (name) to something else? Not this search works only with field name and condition =. I want something like: %query%for another field.

Since ‘name’ is the field which is used to identify unique records in most of the modules, so can be used to search records. We can use the ‘Select’ record from the popup. But if we really want to add new field or change the default field for searching the record from a related module, the following changes would help to implement this.

The following steps I tried to implement this.

  1. Override vardefs for Opportunities module by creating a new php file at
    legacy\custom\Extension\modules\Opportunities\Ext\Vardefs_override_account_search_phone.php
    with this
<?php
$dictionary['Opportunity']['fields']['account_phone']=array(
		'name' => 'account_phone',
                'rname' => 'phone_office',
                'id_name' => 'account_id',
                'vname' => 'LBL_ACCOUNT_PHONE',
                'type' => 'relate',
                'table' => 'accounts',
                'join_name' => 'accounts',
                'isnull' => 'true',
                'module' => 'Accounts',
                'dbType' => 'varchar',
                'link' => 'accounts',
                'len' => '255',
                'source' => 'non-db',
                'unified_search' => true,
                'required' => true,
                'importable' => 'required',
                'required' => true,
);

‘rname’ => ‘phone_office’, and ‘id_name’ => ‘account_id’ are accounts fields used to relate opportunity to an account.

  1. Added a new label ‘LBL_ACCOUNT_PHONE’ at legacy\custom\Extension\modules\Opportunities\Ext\Language\en_us.lang.php
<?php
$mod_strings['LBL_ACCOUNT_PHONE']='ACCOUNT PHONE';
  1. We can add this new field ‘account_phone’ in detailviewdefs.php for the opportunities module or replace existing relate field with this new at legacy\custom\modules\Opportunities\metadata\detailviewdefs.php
    In my case, I added it beside Description field.
<?php
...
5 =>
        array(
          0 =>
          array(
            'name' => 'description',
            'nl2br' => true,
          ),
		  1 => 'account_phone',
        ),

4.From the admin panel do Quick Repair & Rebuild
and from the command line from the root run the following command to clear the cache/prod
php bin/console cache:clear

1 Like