Dependent OptionSet in Dynamics CRM V9

It is known that for the moment there is no way to set up a dependency between two OptionSet fields with OOB functionalities. It is possible to implement this scenario using JavaScript code as the field type used is OptionSet. We could have implemented it with a simple configuration if the Field type were a LookUp.


Let’s take the following example:
– OptionSet A with the following values A1, A2.
– OptionSet B with the following values B1, B2, B3, B4, B5, B6.
– If A1 is selected, only B1, B2, B4 can be selected.
– If A2 is selected, only B3, B5, B6 can be selected.

I implement a JavaScript method that you can use for every two dependents OptionSet fields:

MEA.OptionSet.Utilities = {
//Cascading Utility
optionSetBValues : null,
Cascade: function (executionContext, optionAName, optionBName, dependecies) {
var formContext = executionContext.getFormContext();
var selectedAValue = formContext.getAttribute(optionAName).getValue();
var optionSetBControl = formContext.getControl(optionBName);
if (optionSetBValues == null)
optionSetBValues = optionSetBControl.getOptions();
if (selectedAValue != null) {
var dependeciesB = dependecies.find(d => d[0] == selectedAValue).slice(1);
var filtredOptionB = optionSetBValues.filter(v => dependeciesB.includes(v.value));
filtredOptionB.forEach(d => {
else {

Comma separated list of parameters: 


  • “mea_optionacode”: optionA schemaName.
  • “mea_optionbcode”: optionB schemaName.
  • [[1,1,2,4],[2,3,5,6]]: Array containing the dependencies:
    • [1, 1, 2, 4]: value 1 selected, only values 1, 2, 4 can be selected.
    • [2, 3, 5, 6]: value 2 selected, only values 3, 5, 6 can be selected.

One thought on “Dependent OptionSet in Dynamics CRM V9

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s