Menu

SuiteCRM Master Classes 2018

Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: How to create an Associated Dropdown

How to create an Associated Dropdown 1 week 3 days ago #67677

  • rachit_sinha09
  • rachit_sinha09's Avatar
  • Offline
  • New Member
  • Posts: 11
  • Karma: 0
Hi Folks,

I need to create a field with Dropdown type which should be associated with other dropdown type field.

For example:

Parent Dropdown:
1. College
2. University

Associated Dropdown:
A(1) Private College
B(1) Government College

A(2) ABC University
B(2) XYZ University
C(2) PQR University

If we choose College, other dropdown should show only Private or Government College, and same with University.

Note: I did choose Associated dropdown as "Dynamic Dropdown" and it asked me to fill the detail of Parent but it didn't ask me for the mapping.

Thanks!
The administrator has disabled public write access.

How to create an Associated Dropdown 1 week 3 days ago #67689

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 6511
  • Thank you received: 1005
  • Karma: 229
This will require a developer... are you one?

You need to make a custom edit view, and in that view inject some javascript that handles the behaviour you describe.

There are some examples online about injecting javascript, and making custom views.
The administrator has disabled public write access.

How to create an Associated Dropdown 1 week 3 days ago #67692

  • amariussi
  • amariussi's Avatar
  • Offline
  • SuiteCRM Is My Life
  • Posts: 1015
  • Thank you received: 230
  • Karma: 54
You should do this:

1. Create the dropdowns
Go to Admin>Dropdown Editor

. create parent dropdown:
dropdown name: school_type_list
Label: School Type

Add two values:
Label: College
Key: college

Label: University
Key: university

Save

. Create second dropdown:
field name: school_detail_list
Label: School Detail

Add two values:
Label: -
Key: -
(leave the first line with empty values)

Label: Private College
Key: college_private

Label: Government College
Key: college_government

Label: ABC University
Key: university_abc

Label: XYZ University
Key: university_xyz

Label: PQR University
Key: university_pqr

Save

3. Add fields in module (for example Contacts)
go to Admin>Studio>Contacts>Fields
. Add dropdown field (parent)
field type: dropdown
field name: school_type
Label: School Type
Select school_type_list as dropdown
When you save the field name will become shool_type_c (note "_c" appended at the end)

. Add second dropdown field (slave)
field type: DynamicDropdown
field name: school_detail
Label: School Detail
Select school_detail_list as dropdown
parent dropdown: shool_type_c (this is the name of the parent field assosciated)
When you save the field name will become shool_detail_c (note "_c" appended at the end)

4. Add fields to Edit view
go to Admin>Studio>Contacts>Layouts>EditView
Add both fields to edit view (possibly in same line)
Save and deploy

5. Test
Go to Contacts and try adding a new contact

You should see what you are looking for
Last Edit: 1 week 3 days ago by amariussi.
The administrator has disabled public write access.

How to create an Associated Dropdown 1 week 3 days ago #67702

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 6511
  • Thank you received: 1005
  • Karma: 229
@amariussi I understood that he wants a change in one Dropdown to change the list on the second. Does your set up do that? :ohmy:

How does it know which values you want? Is it just from the key?

So for "college_private" it knows only appears when parent dropdown is "college"?
The administrator has disabled public write access.

How to create an Associated Dropdown 1 week 3 days ago #67705

  • amariussi
  • amariussi's Avatar
  • Offline
  • SuiteCRM Is My Life
  • Posts: 1015
  • Thank you received: 230
  • Karma: 54
@pgr

... in fact I am not sure I understood what he wants because the english was not "perfect".

What I described is the set up of a dynamic dropdown in which available values of the second dropdown depend on the value selected in first dropdown.

So if you select College in the first dropdown, you will have only the options Private college and Government college. If, instead, in the first dropdown you chose University. in the second you will be able to choose from University ABC, PQR and XYZ
The administrator has disabled public write access.

How to create an Associated Dropdown 1 week 3 days ago #67709

  • bs165
  • bs165's Avatar
  • Offline
  • New Member
  • Posts: 7
  • Karma: 0
I can confirm that the above method works...a little more time consuming when values in a dropdown list are repeated (example being different brands of an item being available in the same color), meaning if brand X and brand Y are both selling yellow and green helmets, the color dropdown list must contain:

brandX_yellow
brandY_yellow
brandX_green
brandY_green

hopefully in the future we can see an option similar to the "Edit Visibility" that they have in this article: support.sugarcrm.com/Knowledge_Base/Stud...dent_Dropdown_Lists/

because currently making a three layer dynamic dropdown setup is much more time consuming on our part than it could be.
The administrator has disabled public write access.

How to create an Associated Dropdown 1 week 3 days ago #67711

  • amariussi
  • amariussi's Avatar
  • Offline
  • SuiteCRM Is My Life
  • Posts: 1015
  • Thank you received: 230
  • Karma: 54
Here is the sequence:















The administrator has disabled public write access.
The following user(s) said Thank You: rachit_sinha09

How to create an Associated Dropdown 1 week 3 days ago #67714

  • amariussi
  • amariussi's Avatar
  • Offline
  • SuiteCRM Is My Life
  • Posts: 1015
  • Thank you received: 230
  • Karma: 54
To edit a long list of values you can edit a php file:
custom/include/language/en_us.lang.php

However you must be careful not to ruin it or you may have problems so take a backup first.

My example is:
<?php

$GLOBALS['app_list_strings']['school_type_list']=array (
  'college' => 'College',
  'university' => 'University',
);
$GLOBALS['app_list_strings']['school_detail_list']=array (
  '' => '',
  'college_private' => 'Private college',
  'college_government' => 'Government college',
  'university_abc' => 'University ABC',
  'university_xyz' => 'University XYZ',
  'university_pqr' => 'University PQR',
);

Please note that other custom dropdowns will also be saved in the same file.
The administrator has disabled public write access.
The following user(s) said Thank You: pgr, rachit_sinha09

How to create an Associated Dropdown 1 week 2 days ago #67742

  • rachit_sinha09
  • rachit_sinha09's Avatar
  • Offline
  • New Member
  • Posts: 11
  • Karma: 0
Hi @amariussi,

It's done.
Thanks for describing in such a great manner. I am pretty much new in Suite/Sugar CRM.
It was very much helpful.

Thanks!
The administrator has disabled public write access.

How to create an Associated Dropdown 1 week 2 days ago #67754

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 6511
  • Thank you received: 1005
  • Karma: 229
@amariussi I just learned something new, I had no idea SuiteCRM could do this :-)

Your post seems almost ready to go into the Docs site, maybe as a blog post? What do you think?
The administrator has disabled public write access.

How to create an Associated Dropdown 1 week 2 days ago #67762

  • amariussi
  • amariussi's Avatar
  • Offline
  • SuiteCRM Is My Life
  • Posts: 1015
  • Thank you received: 230
  • Karma: 54
@pgr Thanks!

Use it as you wish both in the documentation and in your blog.
The administrator has disabled public write access.

How to create an Associated Dropdown 1 week 2 days ago #67767

  • rachit_sinha09
  • rachit_sinha09's Avatar
  • Offline
  • New Member
  • Posts: 11
  • Karma: 0
Hi,

I have got one more issue, In Email Settings, when I put the details in SMTP Mail Server and SMTP Port No, and also I receive the Test Email with the same settings, but as soon as I save the details, it gets washed-out, and next time when I open the Email Settings, details are not there.
And due to which I am not able to send any email via application.

So is there any other setting required for the same?

Thanks!

Pardon me for these silly questions, I just started using the application. :)
The administrator has disabled public write access.

How to create an Associated Dropdown 1 week 2 days ago #67768

  • amariussi
  • amariussi's Avatar
  • Offline
  • SuiteCRM Is My Life
  • Posts: 1015
  • Thank you received: 230
  • Karma: 54
The administrator has disabled public write access.
The following user(s) said Thank You: rachit_sinha09

How to create an Associated Dropdown 1 week 2 days ago #67789

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 6511
  • Thank you received: 1005
  • Karma: 229
@amariussi many congratulations on going over 1000 posts!

You probably have the highest post-to-thank-you ratio in the Forums, meaning you are the most helpful person around :-)

1000 Thanks for all this excellent help!
The administrator has disabled public write access.

How to create an Associated Dropdown 1 week 2 days ago #67792

  • amariussi
  • amariussi's Avatar
  • Offline
  • SuiteCRM Is My Life
  • Posts: 1015
  • Thank you received: 230
  • Karma: 54
I didn't realise reaching 1000!

In any case I am far from reaching your levels. Also in consideration of what you have done before joining the team!!!

Thanks!
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.066 seconds
Powered by Kunena Forum