Learning Sugar Logic: Dynamic Dropdown Subindustry field

sugarcrmdevelopers —  June 9, 2011 — 23 Comments

Some of the new features enabled by Sugar Logic are not yet available from Studio. One of those features is dependent dropdowns. However, creating a dependent dropdown in Sugar 6.1/6.2 is as easy as creating simple vardef extension metadata file and performing a quick repair.

Lets say we wanted to have a Subindustry field in Accounts driven by the value of the Industry field.  We can limit the visibility of the field as well so that its only visible when one of a couple of the values available in the Industry dropdown are selected.

Lets say we wanted the mapping:

Education: College, High School, K-12

Banking: Commercial, Investment, Retail, Credit Union

 

First, we will need to create the subindustry_c dropdown field in studio. We need to create a dropdown list that has all the values that we would possibly want to have as a subindustry. I also recommend using keys that will be easy to map to a parent key in the Industry list. So for subindustry we can use the following list.

Key Label
edu_college College
edu_high High School
edu_k12 K-12
bank_comm Commercial
bank_invest Investment
bank_retail Retail
bank_cred Credit Union

Once we have saved the new field and added it to the layouts, its time to make it dependent. We can create a vardef extension file in “custom/Extension/modules/Accounts/Ext/Vardefs/sub_industry_dep.php”

 

After creating the extension file, you’ll need to hit both “Quick Repair and Rebuild” and  “Rebuild Javascript Languages” from the admin repair menu.

You should now have a working dependent dropdown.

 

23 responses to Learning Sugar Logic: Dynamic Dropdown Subindustry field

  1. 

    I do following step , but dependent drop down didn’t work [sugarce6.2(upgrade from 6 to 6.2, Ubuntu 10.10)]
    1.created custom dropdown field.attached subindustry list with the field.
    2.put subindustry_c dropdown field in editview and detailview.
    2.copy paste above code to vardef in ext folder & do run repair & Rebuild Javascript Language.

  2. 
    Christopher Blum June 28, 2011 at 8:49 am

    I can’t get this to work either. I followed the directions exactly and even copied and pasted the code and it still does not work. SugarCRM CE 6.1.2

  3. 

    nothing happens

  4. 

    This works!  Name new drop down field as sub_industry_c (instead of subindustry_c)

  5. 

    I’m having the same problem as the previous 3 users. Is this only available for Sugar Pro editions?

  6. 
    Mark Puettcher May 8, 2012 at 9:32 am

    same problem here

  7. 

    Wow! so cool, It’s easy for develop dependent DDL on Sugar 6.2.5. 

  8. 

    Hi. I tried both on a 6.4.5 and on a 6.3.3 but nothing happens when I choose Banking or Education in the industry dropdown. the field and the function are both called sub_industry_c. Is it any difference with those versions? Thanks

  9. 

    Same problem.

    SugarCRM 6.5 CE doesn’t have Logic.?
    Is there any other ways.?

  10. 

    Is there a way to make a *multi*select dynamic? I have a “product” dropdown and “descriptor” multi-select which needs to show different values dependent on product selection. Doing it in code is just fine by me as long as it’s upgrade safe. thanks.

Trackbacks and Pingbacks:

  1. Dependent dropdowns in new way (6.1, sugar logic) - SugarCRM Forums - October 5, 2011

    […] […]

  2. Sugar Logic - dropdown dependencies - SugarCRM Forums - November 16, 2011

    […] […]

  3. How to create Dependent dropdown - SugarCRM Forums - January 28, 2012

    […] Originally Posted by gokulakannan Hai Friends, I'm new to SugarCRM, i want to create a dependent dropdown.For example im having two dropdowns, 1) Customer Type 2)Customer Name In the 1st options are (a)Engineering, (b)Polytechnic, (c)Arts & Science 2nd dropdown contains the name of the customer. If i select customer type as Engineering then 2nd should display only the names of engineering colleges. Thakns in advance Check out this blog post to see how to do it with Sugar Logic. http://developers.sugarcrm.com/wordp…ndustry-field/ […]

  4. Dependent Dropdown lists in SugarCRM 6.4 - Tech Forum Network - February 18, 2012

    […] module from the studio. I am trying to implement dependency on the dropdown lists using the this tutorial but somehow it doesn’t seem to work. I have checked it over and again my code is the same as […]

  5. Dependent dropdown with vardefs, Oh my! Help me, Obi wan! - May 7, 2012

    […] […]

  6. Populating lists/dropdowns - May 22, 2012

    […] […]

  7. No Change in DropDown - July 14, 2012

    […] […]

  8. Dependent dropdowns in 6.5 in code, how? - August 29, 2012

    […] […]

  9. Have a multiselect generated on the fly - January 2, 2013

    […] […]

  10. One dropdown effect another dropdown values - March 24, 2013

    […] […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s