Hi John,
I created the field via the code. After creating (or modifying) the following three files:
custom/Extension/modules/Contacts/Ext/Vardefs/account_type.php (new)
<?php
$dictionary["Contact"]["fields"]["account_type_search"]= array(
'name' => 'account_type_search',
'vname' => 'LBL_ACCOUNT_TYPE_SEARCH',
'query_type' => 'default',
'source' => 'non-db',
'type' => 'enum',
'options' => 'account_type_dom',
'studio' => array('searchview'=>true,'visible'=>false),
);
custom/modules/Contacts/metadata/SearchFields.php (copied from modules/Contacts/metadata/SearchFileds.php and added the following code)
'account_type_search' => array (
'db_field' =>
array (
0 => 'id',
),
'query_type' => 'format',
'operator' => 'subquery',
'subquery' => 'SELECT accounts_contacts.contact_id FROM accounts_contacts
INNER JOIN accounts ON accounts.id = accounts_contacts.account_id AND accounts.deleted = 0
WHERE accounts_contacts.deleted = 0 AND accounts.account_type IN ({0})',
),
custom/modules/Contacts/metadata/metafiles.php (new)
<?php
$metafiles['Contacts']['searchfields']='custom/modules/Contacts/metadata/SearchFields.php';
and after a Quick Repair & Rebuild, the new field was available in the list of hidden fields for the Advanced Search and now Iām able to filter the Contacts by their Account name.
The Quick Repair & Rebuild didnāt ask me to execute any change.
The problem is that this field is only available in the Advanced Search, It should be also added to the Popup Search but there itās missing. Itās also missing from the main fieldās list in Contacts -> Fields.
Iām sure I missed something, but Iām very new to SuiteCRM and I wasnāt able to find the error⦠is this the right process to add this kind of field?
Thanks