Dynamic MultiSelect


How would I create Dynamic Multi-select fields?
Basically I need a Multi-select drop-down (multenum)dependent on a Single drop-down (enum).

Thanks in advance.

This is possible, im sure there are other posts around the forum explaining how to do this. Im not sure myself will need to look into it.

Hi Andrew,

Nothing on the forums that I could find, hence the post.
I know I need some js script to accomplish it.
Just don’t know what to look for.
Any pointer/hints will be helpful.

Thanx in advance.

No need for any custom js to create dynamic Dropdowns in SuiteCRM :wink:

Ok the first thing you need to do is create your Parent select field:

Go to studio and create a custom field for your chosen module with the type DropDown, in this example Ill call is open_close_c.
Add a Drop down list with the values :

open : Open
close : Closed

so the key value is open and the lable is Open etc.

Now create a second custom field called is_open_c with the type Dynamic DropDown

Add a Drop down list for this field with the values :

open_yes : Not closed
closed_yes : Is closed

and in the Parent DropDown textbox enter open_close_c.

You see how this works? we are using the key value of the parent dropdown with an underscore to link the values.

Now if you place both these field in the editview you will see when Open is selected on open_close_c Not closed is shown on is_open_c and vice versa, the values will change dynamically in is_open_c dependant on what is chosen in its parent.

Hi Andrew,

Thanx for the reply. However what your referring to is Dynamic drop-down which is single select.
I need Multi-select drop-down dependent on Single select drop-down.
I guess the attached screen-shot will give a clearer picture.


Ahh I see, yeah I think you will need to code that. A simple bit of Javascript/Jquery would do for that.

You want to create a new .js file containing your code and place it in the custom folder of your chosen module.

And include the path to the js file in custom editviewdefs like this:


'includes' => 
      array (
        0 => 
        array (
          'file' => 'modules/Accounts/Account.js',
        1 => 
        array (
          'file' => 'custom/modules/Accounts/NDA_expiry.js',

Do you actually know JavaScript?

Hi Andrew,

I don’t know the javascript to use in this case.
Any pointers will be of great help.

Thanx in advance.

I get the feeling you just want us to code it out for you :whistle: which is not really what this forum is about, its for helping developers not doing the work for them.

In any case something like below. Im using jquery rather than standard js.

//In the javascript file u created above: 
$(function() {

        $('#krm_status_c').on('change', function() {

        if($(this).val() == 'krm_pending'){

            $("#krm_mismatch_c option[value='Name_Mismatch']").prop('selected', true);
        else if($(this).val() == 'krm_in_process'){

            $("#krm_mismatch_c option[value='dob_mismatch']").prop("selected", true);



Change #krm_status_c to the name of your select field and #krm_mismatch_c to the name of your multi-select. Obviously you will have to keep adding to the if and else statments for all your possible options and if you want one value to equal multiple options in you multi-select then you will have to add something like this:

var values="Name_Mismatch,krm_in_process,other value";
$.each(values.split(","), function(i,e){    
   $("#krm_mismatch_c option[value='" + e + "']").prop("selected", true);	

Hi Andrew,

Apologies there.
I ain’t no coder but I catch on fast. I just look for pointers.

However this code you’ve given is awesome!!
Thank you so so much.


No probs