Hi everyone,
I have created a custom field (nif_c) in the Accounts module, and I need to display it as a filter in the Advanced Search of Opportunities.
Context:
• In SuiteCRM, Opportunities are already related to Accounts (each Opportunity has an associated Account).
• The field nif_c exists in Accounts and works correctly there.
• I want to use this field as a search filter in Opportunities, so users can filter opportunities based on the nif_c of the related Account.
What I’ve Tried So Far:
- Added the field to searchdefs.php of Opportunities:
'account_nif_c' =>
array (
'type' => 'relate',
'label' => 'LBL_ACCOUNT_NIF',
'id' => 'account_id',
'link' => true,
'module' => 'Accounts',
'table' => 'accounts',
'rname' => 'nif_c',
'default' => true,
'width' => '10%',
),
- Created a custom Vardef for Opportunities in /custom/Extension/modules/Opportunities/Ext/Vardefs/custom_nif_c.php:
<?php
$dictionary["Opportunity"]["fields"]["account_nif_c"] = array(
'name' => 'account_nif_c',
'rname' => 'nif_c', // Field from Accounts
'id_name' => 'account_id',
'vname' => 'LBL_ACCOUNT_NIF',
'type' => 'relate',
'table' => 'accounts',
'module' => 'Accounts',
'source' => 'non-db',
'link' => 'accounts',
);
?>
-
Ran a Quick Repair & Rebuild in SuiteCRM.
-
Cleared the cache and restarted Apache.
Problem:
• After adding this, the field does not appear in the Advanced Search of Opportunities.
• In some cases, adding the custom file caused all fields to disappear from the Opportunities module.
• There are no syntax errors in the PHP files.
Question:
How can I properly add a custom field from Accounts (nif_c) as a filter in the Advanced Search of Opportunities without breaking other fields?
Any help or insights would be greatly appreciated!
Thanks in advance!