One of our friend requested me to help on the below requirement, Change Option Sets based on parent option set value selection,

Follow the below steps,
Step 1: For this example I am using Contact entity. Open Contact Form.
Step 2: Create First Option Set field,
Display Name: Category
Name: new_category
Options:
Label: Ice Cream & Value: 100000000
Label: Soft Drinks & Value: 100000001

Step 3: Create Second Option Set field,
Display Name: Sub Category
Name: new_subcategory
Options:
Label: Amul & Value: 100000000
Label: Baskin Robins & Value: 100000001
Label: Kwality Wall’s & Value: 100000002
Label: Coca Cola & Value: 100000003
Label: Sprite & Value: 100000004
Label: Pepsi & Value: 100000005

Step 4: Click Here to Download XML and create Data (XML) Web Resource (new_CategoryOptionSetConfig.xml)

Save and Publish the Web Resource.
Step 5: Click Here to download Java Script Code and create new JScript Web Resource (new_ SampleOptionsSet.Js),

Save and Publish the Web Resource.
Step 6: Open Contact form. Drag and Drop the Category and Sub Category Optionset fields on the Contact Form.

Step 7: Click on Contact Form Properties.
- Add new_SampleOptionSet.js to the Form Libraries.
- Add Function SDK.DependentOptionSet.init on Form OnLoad.
- Copy and paste the parameter “new_CategoryOptionSetConfig.xml”, in Comma separated list of parameters…and click on OK. (Remove commas and enter manually)


- Double click on Category Option Set field. Add Function SDK.DependentOptionSet.filterDependentField on Onchange Event.

- Add Parameters (“new_category”,”new_subcategory”) in Comma separated list of parameters…and click on OK. (Remove commas and enter manually)

Save and Publish the Contact Form.
Step 8: Open any New/ Existing Contact record to check below OptionSet behavior on selection,

Please provide your valuable comments on this article.
Source: MSDN
Like this:
Like Loading...