Hello,
It is relatively easy to filter a Quote's Billing Contact Lookup based on the Quote's Billing Account.
Add a custom filter:
../custom/Extension/modules/Contacts/Ext/clients/base/filters/basic/filterContactByParentAccount.php
<?php $viewdefs['Contacts']['base']['filter']['basic']['filters'][] = array( 'id' => 'filterContactByParentAccount', 'name' => 'LBL_FILTER_CONTACT_BY_PARENT_ACCOUNT', 'filter_definition' => array( array( 'account_id' => '' ), ), 'editable' => true, 'is_template' => true, );
Then add that filter to the Record View:
../custom/Extension/modules/Quotes/Ext/clients/base/views/record/record.php
<?php //TAI-JEK-Feb. 2021-Add an initial filter to the billing_contact_name field so it only shows Contacts related to the Billing Account. //Loop through all panels on the Quote Layout. foreach ($viewdefs['Quotes']['base']['view']['record']['panels'] as $i => $panel) { //Loop through all fields on the Layout looking for the field we want to modify. foreach ($panel['fields'] as $j => $field) { if(is_array($field)){ if(isset($field['name'])){ $fieldName = $field['name']; } } else{ $fieldName = $field; } if ($fieldName == 'billing_contact_name') { //Will set the custom filter here $viewdefs['Quotes']['base']['view']['record']['panels'][$i]['fields'][$j] = array ( 'name' => 'billing_contact_name', 'initial_filter' => 'filterContactByParentAccount', 'initial_filter_label' => 'LBL_FILTER_CONTACT_BY_PARENT_ACCOUNT', 'filter_populate' => array ( ), 'filter_relate' => array ( 'billing_account_id' => 'account_id', ), ); } } }
I'd like to do something similar for the Notes module when a Note is related to a Quote. I could do something similar but I don't know how to get the AccountID when extending the Note's record.php. Should I override the relate.js which would give more options for retrieving the parent Quote's AccountID, similar to this Community Post?
Thank you,
Justin Kuehlthau