This project is read-only.
Project Description
Convention based cascading option set dropdowns for CRM 2011/2013

I wanted the abilty to have two or more cascading dropdowns in Microsoft Dynamics CRM 2011/2013, that would not need a lot of configuration and would be easy to use.

That's why I've developed a solution that is "convention" based and does not need extra configuration.

Convention

All that matters is that you use OptionSet values according to the convention.

If you know that ParentField will not grow beyond 10 elements, then you set the "range" attribute to 1 (1 digit). If there will be up to 100 elements, then you set the "range" attribute to 2 (2 digits)
According to this you then set the optionset values in childField.

Let's assume ParentField optionset has values:
  • 10000001
  • 10000002
  • 10000003
  • ...

ChildField examples are below.

optionset values example filtering for range set to 1:

selecting parentField: 10000001, shows
childField:
10000010
10000011
10000012
...
10000019

parentField: 10000002
childField:
10000020
10000021
...
10000029


optionset values example filtering for range set to 2:

selecting parentField: 10000001, shows
childField:
10000100
10000101
10000102
...
10000199

parentField: 10000002
childField:
10000200
10000201
...
10000299

Binding to onchange event

All you need to do next is bind this javascript call to the onChange event of the parent dropdown and you are good to go. You can do this simply by double-clicking on the option set (Form is in edit mode) and under Events tab, you can bind the onChange event to the method below

call example for filtering with range set to 1:
scope.onParentChangeFilterChild('parentoptionsetid', 'childoptionsetid', 1)

method signature is:
scope.onParentChangeFilterChild = function (parentField, childField, range)

Last edited Jan 12, 2015 at 3:01 PM by ttajic, version 9