Remi Boigey, Partner Technical Consultant @ Microsoft France, did a new silverlight application in order to create Dependent Picklist by using a user friendly interface.
- It provides a generic, re-usable JScript library that can be used for any pair of option set fields.
- It allows for a chain of dependent option set fields. Because each dependent option set field options are filtered based on the value of another field, additional option set fields options can be filtered by the option chosen in the first dependent option set field. This allows for the possibility of a set of hierarchically dependent option set fields.
- The filtering of dependent options is set in an XML Web resource. This allows for changing the option mappings without changing the code. Editing an XML Web resource is easier for a non-developer to configure options with less opportunity to break the code.
- The solution supports multiple languages. The filtering is based solely on the data value of the options rather than any text in the options.
- Filtering works for any number of instances of an attribute control on the form.
Install the solution
Step 1 : Save the CRM solution on your disk - Download here
Step 2 : Import the solution – Settings / Solutions / Import
Click on next buttons and close the form.
Refresh the web page.
Test the solution
In order to test the solution, you can use the Case entity with the two OptionSet fields: Case Type and Priority. We will filter them as displayed in the following table:
When you finalized the mapping, click on ‘Get script’ button.
In order to use our script, you need to add a XML web ressource to the targeted entity.
- Go to Settings / Customization / Customize the System / Web Ressources
- Click on New and fill the following attributes
- Name = Schema Name
- Display Name
- Select Data XML
- Click on ‘Text editor’ and paste your clipboard
- Save the form
- Go to Settings / Customization / Customize the System / Entities / Case / Forms
- Open the Main Form
- Click on Form properties
- Add “gps_SDK.DepdenentOpeitonSet.js” script as available libraries
- Then, in the ‘Event Handlers’ section, add the SDK.DependentOptionSet.init function on the control Form for the event OnLoad.
- And follow the printscreens :
- Click on Add
– Function: SDK.DependentOptionSet.init
– Check ‘Pass execution context as first parameter’
The parameter is the schema name of the Web ressource we just created.
- Click on OK
- Save the Form.
- Now, we have to add a function ‘SDK.DependentOptionSet.filterDependentField’ on the onchange event of the primary field (here case type)
– Double click on the ‘Case Type"’ Field
– Select the Events Tab
– Click on Add under the Event Handlers section
- Function: SDK.DependentOptionSet.filterDependentField
- Don’t Check ‘Pass execution context as first parameter’
Parameters are the schema name of the option set fields..
- Click on OK
- Save the Form
- Publish all customizations
- Navigate to Case Form and use the picklists : Case Type and Priority