Dependent Related Field using pop up filter

There are two modules e.g States and City module related to each other by some relation.
These two modules are also related to Accounts module.

In the Accounts Edit View, when I select the State from States pop up list view, and proceed to select City, what I want is : City pop up list view should only list records related to the selected State.

hope you understand my question?

And Thanks in Advance.

Using

         'displayParams' => 
        array (
          'initial_filter' => '&account_name="+this.form.{$fields.account_name.name}.value+"',
        ),

I achieved my goalā€¦

Oh wow!!! I think m gudā€¦ :cheer:

Hi,

I am completely unfamiliar with php, but can follow instructions.
Can you help me to achieve similar thing in a custom module where I want the second drop down to be dependent upon the first one.

Thank You

Hi guys,

I need to do exactly the same, but with multiple fields.
I can easily filter the pop up with a single field by following your example, but run into trouble when I try passing multiple fields in an array to initial_filter:


...
           'displayParams' => 
            array (
              'initial_filter' => array (
			  	'&account_management_type_c_advanced[]=3',
		  	        '&status_advanced={"Active"}',
			  ),
            ),
...

Any advice will be greatly appreciated!

I figured it out:


       ...
            'displayParams' => 
            array (
              'initial_filter' => '&account_management_type_c_advanced[]=2&employee_status_advanced={"Active"}',
            ),
     ...

No need for arrays - just add all the required fields and their values to the query string, separated by ā€˜&ā€™ :smiley:

en que apartado se escribe este pedazo de cĆ³digo antes mencionado?? :unsure: :unsure:

When I add double quote ā€œā€, the link is no longer clickable. That is, if I specify a simple one, such as

ā€˜initial_filterā€™ => ā€˜&account_name_advanced=testacctā€™, it works fine. But, if it becomes ā€˜initial_filterā€™ => ā€˜&account_name_advanced="+this.form.{$fields.account_name.name}.value+"ā€™, the popup link is no longer clickableā€¦

Any idea?

thanks

Just as information. @sandeepg code is added in editviewdefs.php located in \custom\modules\YOUR_DESIRED_MODULE\metadata\editviewdefs.php

It goes in the field properties like this:

...
    array (
            'name' => 'contract_account',
            'label' => 'LBL_CONTRACT_ACCOUNT',
          ),
          1 => 
          array (
            'name' => 'contact',
            'studio' => 'visible',
            'label' => 'LBL_CONTACT',
            'displayParams' => 
            array (
              'initial_filter' => '&account_name="+this.form.{$fields.contract_account.name}.value+"',
            ),
          ),

        ),
...

You can check modules/AOS_Contracts/metadata/editviewdefs.php as an example.

Thanks,

BrozTechnologies

1 Like

Hi,

Can we use the same for listview and detailview as well?? If not how we can achieve same for the list and detail.

Please guide