"тнιѕ вℓσg ¢συℓ∂ ѕανє уσυя мσηєу ιƒ тιмє = мσηєу" - ∂.мαηנαℓу

Sunday 13 October 2013

Dependent Option Sets in CRM 2013 OR Cascading Option Sets in CRM 2013 OR How to configure Dependent Option Sets in CRM 2013 OR 3- tier Option Sets sample in CRM 2013

Please note that this post is the continuation of the post below.

2 - tier option sets sample ( This post also explains the basics ) 
http://crmorion.blogspot.com/2013/10/dependent-option-sets-in-crm-2013-or.html

In this post we would like to extend the logic using the sample given in CRM 2013 SDK to include one more option set. In simple words, 3 - tier option sets. Dependency of these 3 fields are shown below.



For instance, if a user selects Hardware, he /she would be able to see options Desktop / Laptop. And if Desktop is selected, the user would be able to see Workstation x1000 and Workstation x2000.

So we have 3 option sets 

1. Category



 2 . Sub Category



3. Type



Hope you had a look at 
http://crmorion.blogspot.com/2013/10/dependent-option-sets-in-crm-2013-or.html

There are no changes to be done in the SDK.DependentOptionSet.js

SystemsOptionSetConfig.xml has to be amended with the new option set values as shown below.

<DependentOptionSetConfig entity="new_system" >
 <ParentField id="new_category"
              label="Category">
  <DependentField id="new_subcategory"
                  label="Sub Category" />
  <Option value="100000001"
          label="Software">
   <ShowOption value="100000000"
               label="Business App" />
   <ShowOption value="100000001"
               label="OS" />
  </Option>
  <Option value="100000000"
          label="Hardware">
   <ShowOption value="100000002"
               label="Desktop" />
   <ShowOption value="100000003"
               label="Laptop" />
  </Option>
 </ParentField>
  <ParentField id="new_subcategory"
              label="Sub Category">
    <DependentField id="new_type"
                    label="Type" />
    <Option value="100000000"
            label="Business App">
      <ShowOption value="100000000"
                  label="CRM" />
      <ShowOption value="100000001"
                  label="HRM" />
    </Option>
    <Option value="100000001"
            label="OS">
      <ShowOption value="100000003"
                  label="Windows 7" />
      <ShowOption value="100000002"
                  label="Windows 8" />
    </Option>
      <Option value="100000002"
        label="Desktop">
        <ShowOption value="100000004"
                    label="Workstation x1000" />
        <ShowOption value="100000005"
                    label="Workstation x2000" />
      </Option>
      <Option value="100000003"
        label="Laptop">
        <ShowOption value="100000006"
                    label="Laptop T410" />
        <ShowOption value="100000007"
                    label="Laptop T510" />
      </Option>
  </ParentField>
</DependentOptionSetConfig>


Nota Bene: In the above config xml file , we could see that in 2 places we defined parent field and the corresponding child field. And then corresponding values. The key advantages of this structure is that its extendable and also configurable.



Function calls to be done are explained  in

Additional function call to be done is on the Sub Category. 

id est : When the user selects the Sub Category, the Type option set to be filtered based on dependency.

We need to do the function call on the OnChange event of Sub Category. So lets click on Add.


Function: SDK.DependentOptionSet.filterDependentField

Parameters :  "new_subcategory", "new_type"


Okay and press Okay

We need to save and publish the form. Now get ready to see the magic.






Thank you CRM 2013 SDK !



1 comment:

  1. This solution doesn't work in IE8, there is an error message during theopening of the form on the OnChange event of the field. Do you know why?

    ReplyDelete