Dynamic Dropdown Creation

Please send me the steps to create a dynamic drop down list

For ex Drop Down 01 APAC, EMEA, SAM.NAM, Other ( If I selected one here ex: APAC)
Drop Down 02 Comes only APAC countries here and other selectors also must be the same

Simply If I pick one from 1st drop down ,2nd drop down must be displayed relevant to 1st selected one

This has been a previous post on dynamic dropdowns


This was not worked for me .DO I need to install separately purchased plugin installed in SuiteCRM


What is the vardefs of a dynamic dropdown ?
I don’t use Studio for create all my custom field.

Some one have a sample vardefs of a dynamic dropdown ?


What are vardefs ? I didn’t get it

To create a working Dynamic Dropdown you have to follow some simple steps:

  1. Create the Master dropdown
    Go to Admin->Dropdown Editor
    Create a new dropdown and call it global_regions_list Label: Global regions
    Add the fields
    Key: APAC - Label: APAC
    Key: NAM - Label NAM
    Key: SAM - Label: SAM

  2. Create the Slave dropdown
    Go to Admin->Dropdown Editor
    Create a new dropdown and call it regional_countries_list Label: Regional Countries
    Add the fields for NAM:
    Key: NAM_US - Label: United States
    Key: NAM_CA - Label: Canada

Add the fields for SAM:
Key: SAM_BR - Label: Brazil
Key: SAM_AR - Label: Argentina
KEY: SAM_CL - Label: Chile

Finish adding all the fields in the same way: underscore

Once finished save and proceed to the next step

  1. Create Master dropdown field
    Go to Studio - Accounts (you can go in any module that you wish) -> Fields
    Create a New field of type Dropown and call it global_regions Label: Global Regions
    (note that the name of the field will be updated by the system to global_regions_c)
    Select the dropdown called global_regions_list from the dropdown menu
    Then save

  2. Create the slave dropdown field
    Go to Studio - Accounts -> Fields
    Create a New field of type DynamicDropown and call it regional_countries Label: Regional Countries
    (note that the name of the field will be updated by the system to regional_countries_c)
    Select the dropdown called regional_countries_list from the dropdown menu
    In the Parent Dropdown field write the name of the Master Dropdown: global_regions_c
    Then Save

  3. Add the fields to the edit view
    Go to Studio - Accounts -> Layouts->EditView
    Add a new line in the layout
    Drag both fields from the left to the layout.
    Click on Save and Deploy

  4. Test
    Go to Accounts
    Create or Edit a new record and test the Dynamic dropdown


Here’s a simple example:

The option lists:

$GLOBALS['app_list_strings']['area_list']=array (
  'A1' => 'Area 1',
  'A2' => 'Area 2',

$GLOBALS['app_list_strings']['area_sub_list']=array (
  'A1_S1' => 'Subarea 1.1',
  'A1_S2' => 'Subarea 1.2',
  'A1_S3' => 'Subarea 1.3',
  'A2_S4' => 'Subarea 2.1',
  'A2_S5' => 'Subarea 2.2',

The dropdowns:

$dictionary['Account']['fields']['t1_c'] = array(
	'inline_edit' => '1',
	'labelValue' => 't1',
	'name' => 't1_c',
	'type' => 'enum',
	'vname' => 'LBL_T1_C',
	'options' => 'area_list',
	'default' => 'A1',
	'source' => 'custom_fields',

$dictionary['Account']['fields']['t2_c'] = array(
	'inline_edit' => '1',
	'labelValue' => 't2',
	'name' => 't2_c',
	'type' => 'dynamicenum',
	'vname' => 'LBL_T2_C',
	'options' => 'area_sub_list',
	'default' => 'A1_S1',
	'source' => 'custom_fields',
	'parentenum' => 't1_c',

The key here is to define the ‘parentenum’ on the dependent drop down…



Thanks m42.

udaya88, vardefs is a file with definition of field. (type, length, default value, label… ) These file are used for database (and other sure)

Thanks you very much amariussi. It is worked for me. And one Little Question If there is no value in child drop down for a selected Parent’s drop down list item how cant we mention it. Consider this
( Parent: ABC,DEF,TRY)

{Child:ABC_apple,ABC_mango,ABC_grapes,DEF(no values),TRY(no vales)}

Please send me a solution for this

Try creating in the lists an empty item (you don’t fill anything in the key). When that item is selected from the list nothing should be stored.

It worked and thanks for the reply.
Is there any way to edit(with out editing the code) address fields Because I need to exclude country filed in the default address field in the Leads.

Unfortunately the address field is composed a few fields that are assembled together.

The only way to modify the behaviour at the moment is to edit code.

Another way would be to create your own custom fields for the address. This may carry some small loss of functionality (but nothing really important).

Personally I have created a Module to handle addresses so that a company can have many addresses and people too. Again this other approach is also complicated.

Thanks amariussi. Can I add the Quotes module in the edit view of Opportunities ?


I followed exactly the steps described above but it doesn’t work for me. Is there any new step to follow with new versions of SuiteCRM ?



Please describe PRECISELY (including SuiteCRM version, OS, etc.) what you did so we can try to be of help!

Please check all your logs and report any errors.

I have categories and subcategories of claims.

Here is what I created :
1/ A dropdown list for categories (item name - display name) :
travel - Travel
bank - Bank
telecom - Telecom

2/ A dropdown list for subcategories :
travel_car - Car
travel_train - Train
travel_bus - Bus
travel_plane - Plane
bank_fraud - Fraud
bank_stolen - Credit card stolen
telecom_invoice - Invoice
telecom_contract - Contract

3/ A field with the “Dropdown” type linked to the first dropdown list

4/ A field with the “Dynamic Dropdown” type linked to the second dropdown and with the first dropdown list as parent.

Then I added the two fields in the edit view. But when I select a category, I can choose any subcategory. That’s not the behaviour I want.

Thanks in advance for your help.

1 Like

You should use as parent the name (remember to add “_c” at the end and use only small cap letters) of the first field and not its dropdown

To be more clear: the name of the dropdowns are those names you defined in the Dropdown editor, while the names of the fields are those you created in Studio.

A few more things that may be of help:
. when finished with editing the views in studio you have to remember to “save and deploy”
. try running a quick repair and rebuild
. try clearing the browser cache (Ctrl+F5)
. check your logs to see if there are errors

If these don’t work:
. please provide the names of the dropdowns
. the names of the fields (as assigned by the system)
. all the filled information in the second (slave) field

1 Like

quick repair and rebuild worked for us thank you!!!

Hello, I created 3 dynamic drop-down lists that are: Country, City and Postal Code.

I would like that when I choose a postal code that it automatically fills me the name of the city. In addition, I would like that when the postal code belongs to Switzerland, I would like that it automatically fills the country = Switzerland and if it is not the case that it leaves empty.

I have seen several forums but it still does not work.

Do you have an idea ?

I use the version Suite CRM : Version 7.9.12 / Sugar Version 6.5.25

Thank you for your help

I would use a combination of the dropdown editor workflow above for the first 2 parts.

  1. select a postal code
  2. based on the postal code, a city is selected

Then, I would use a workflow that on save checks the postal code(s). For example, Toronto where I’m from has postal codes that start with Lxxxxx and Mxxxxxx. L and M. If this is true, the city (or in your case country) is set to Toronto. Or in your case, based on postal code syntax I’m not familiar with, the country would be set to Switzerland.