How to open a popup as per our query on click of relate field

Hello All,

I want to put a custom query for realte field popup like suppose if i want to see only those records which is associate with abc.com, so how we can achieve that how i can add a condition like this

for example - where email_id = ‘abc.com

Please guide

Thanks

@jyotip

  1. If you want to use dynamic filter in editviewdefs.php:
  • Code for custom/modules/<module_name_1>/metadata/editviewdefs.php (as you wrote in the first post):
...
'displayParams' => 
    array (
      'initial_filter' => '&<field_relate>_email_id_advanced="+this.form.{$fields.<field_relate>.email_id}.value+"',
);
...
  • Code for custom/modules/<module_name_2>/metadata/popupdefs.php:
if(!empty($_SESSION['popupMetaFilter'][$module_name][$_REQUEST['action']])&&empty($_REQUEST['name_advanced'])){
    $_REQUEST['email_id_advanced']=$_SESSION['popupMetaFilter'][$module_name][$_REQUEST['action']]['email_id_advanced'];
}else{
    $_SESSION['popupMetaFilter'][$module_name][$_REQUEST['action']]['email_id_advanced']=$_REQUEST['email_id_advanced'];
}
  1. If you want to use static filter:
$popupMeta['whereStatement']=>'<your_SQL_command_WHERE>'
  1. If you want to use filter in select button of subpanel you should make button in custom directory. For example using: include/generic/SugarWidgets/SugarWidgetSubPanelTopSelectButton.php
1 Like

Hello @p.konetskiy

Thanks for the help

i tried but unable to set my custom query for
‘assigned_user_id’ =>
array (
‘query_type’ => ‘default’,
),

it is located in SearchFields.php

I want to add this in SearchFields.php as it is working fine in editviewdefs.php but not in SearchFields.php
‘displayParams’ =>
array (
‘initial_filter’ => ‘&user_kind_c_advanced=Employee’,
),

@jyotip , were you able to implement this one?

@p.konetskiy , hi sir I have a question with regards to the customization on popupdefs. The pre-filtered data will be retain after you reload the page.

@waraikobuot

Yes, because they are saving in session.

@p.konetskiy it is possible to clear the session once the popupdef close?