How to easily create dependent Picklist(Option Set) in CRM 2011 ?


Remi Boigey, Partner Technical Consultant @ Microsoft France, did a new silverlight application in order to create Dependent Picklist by using a user friendly interface.

HomeDependentPickListCRM2011

Solution Features

  • 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 - 

    Step 2 : Import the solution – Settings / Solutions / Import

    importsolutionCRM2011_thumb6

    Click on Browse Button and select the solution DependentPickLists_1_0_0_0_managed.zip.

    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:

Case Type

Priority

Question

High

 

Normal

 

Low

   

Problem

High

 

Normal

   
Request

Normal

 

Low

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.

Step 1

  • Go to Settings / Customization / Customize the System / Web Ressources
  • Click on New and fill the following attributes
    • Name = Schema Name
    • Display Name
    • Type
      • Select Data XML
      • Click on ‘Text editor’ and paste your clipboard
  • Save the form

Step 2

  • 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

image

  • Then, in the ‘Event Handlers’ section, add the SDK.DependentOptionSet.init function on the control Form for the event OnLoad.
  • And follow the printscreens :

form

  • Click on Add

image

Function: SDK.DependentOptionSet.init
Check ‘Pass execution context as first parameter’

‘new_Case_DependentOptionSetConfig’

    The parameter is the schema name of the Web ressource we just created.

  • Click on OK

image

  • 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

image

– Select the Events Tab

image

– Click on Add under the Event Handlers section

  1. Function: SDK.DependentOptionSet.filterDependentField
  2. Don’t Check ‘Pass execution context as first parameter’
‘casetypecode’,’prioritycode’

Parameters are the schema name of the option set fields..

  • Click on OK
  • Save the Form
  • Publish all customizations

publish

  • Navigate to Case Form and use the picklists : Case Type and Priority
Comments (39)

  1. NAG says:

    Hi, I imported this solution. It imported with warning. And alos when i clicked on Dependent Picklist under customization, its giving an expecting as "Debugging resource strings are unavailable etc.,

    And also can't see any entities under Entity on the "Dependent Picklist form".

    Any Idea?

  2. Could you please send me an email with screen shots?

    remib@microsoft.com

  3. VK says:

    Where is the "Get Script" button you mentioned in the article?

  4. VK says:

    Never mind…I am getting the same error as NAG when I click on Dependent Picklist…will send you the screenshot in separate email.

  5. Brady Owen says:

    This is not working as expected please help!

  6. Brady Owen says:

    Is now, perfect!

  7. Inga Seelemann says:

    I can't get this to work.  I followed these steps exactly and then when I go to create a new case, the ribbon on the case screen disappears and the dependent pick list doesn't fire.  I removed the event handler and the ribbon came back. I tried to create a dependent pick list with a custom entity and the same effect.  Not sure how I can debug this.  Too bad, as the front end tool is very nice and easy to use.

  8. pafore says:

    We add a new post for Recurrent problems here : blogs.msdn.com/…/dependent-picklist-recurrent-problems.aspx

  9. Richard Sharp says:

    HI, tried to insta;; and use this, get an exception when browsing to the Dependant Picklists Option in Settings. Have emailed you a screenshot, please advise, I would be very grateful.

  10. Simon Tauscheck says:

    Wow, great useful solution. Thanks!

    PS: I have an CRM based on a german base language, javascript wasn't loaded correctly first. Can be usefull for all europe users, you may want to change the asci code of the javascript…

    but then all works perfect!

  11. Carlyd says:

    Nevermind I got it! Thank you so much!

  12. How can you do two different dependent pick lists on the same form? What do I put in the Form Properties "On Load"? Thanks so much!

  13. Heather says:

    Hi there,

    I used the Dependent Option Sets Silverlight application – and it works great – thank you!

    I have a question – I created a dependency between two option set fields on a form and they work perfectly. I then tried to do the same for another set of fields on the same form but it wont work – is there a solution to get this working?

    Thanks!

  14. Lily says:

    Getting the below error. Please Help!!

    There was an error with this field's customized event.

    Field:window

    Event:onload

    Error:Access is denied.

  15. Boris says:

    Hi,

    got the same error as Lily. This happened when transfered to another environment with SSL authorizaton.

  16. Sreeni Pavalla says:

    Nice Article..!

    Can any one provide me the sample XML that as we need to add as a web resource.

    Thank you in Advance

    Sreeni

  17. Sreeni Pavalla says:

    Do we need to create two options sets ot it will automatically creates when we upload XML data.

    Please suggest me

    Thanks,

    Sreeni

  18. Leon Tribe says:

    Another option for CRM 2011, which is codeless, is to use filtered lookups. Here is my blog explaining the process. leontribe.blogspot.com.au/…/setting-multi-level-categories-against.html

  19. Thanks for your post. Its quite helpful!

    However, i've a requirement where i've 4 optionsets on the form. Now, with the steps mentioned above I can set dependent optionset between first 2 optionsets. Now, I need to populate 3rd optionset based on selection from 2nd optionset and 4th optionset based on selection from 3rd optionset. Can this be achieved?

    Early reponse is much appreciated. Thanks!

  20. Elie says:

    After finalizing all the required steps working on two specific fields (FIeld A) & Field B) i'm not seeing any results. When i select from the drop a specific data from field A, i'm still seeing all the data in field (B) when i'm suppose to see only the mapped data. Any suggestion?

    Elie

  21. Fadl says:

    Thanks for the great article ,Now when I open the CRM using IP address instead of Server Name I got JavaScript error access denied

  22. Ilja says:

    I was able to Import the solution and use the form to set up a couple of dependent option sets, but now I need to modify the dependencies and when I click on "Dependent PicklIsts" in the Nav pane I no longer get the form but the code that was generated instead. Is this correct?  How do I go about redoing some of the dependencies?  Thanks.

  23. neel says:

    Thanks for the great article .. explained in very simple steps ….it worked perfectly 🙂

  24. Waqas says:

    H all andI hello neel could explain some steps you followed coz i am not having any error and neither the dependendent values are working Thanks in advance

  25. Pit says:

    @carlyd

    What is your solution with the problem, that more then 1 dependant picklists is not working?

    I havt 3 picklists, 1 is depanandt to 2 and 2 dependant to 3, but i will not work.

    THX for any help, Greets Pit

  26. koko says:

    Hello, thank you the great tool ,

    Any idea of how can we add more than two dependent pick list on the same form ? any workaround ? having the same code on change event will break the code and both dependent pick lists will not work .

    Appreciate  your help

  27. Fahmeeda Yaseen says:

    i performed the same steps.but this solution not working.no filtering performed. please help me.

  28. Hi, I find the same problem of Lily but in Chrome only.

    There was an error with this field's customized event.

    Field:window

    Event:onload

    To solve this, I modified an javascript, you can find my version on this link.

    ggoulf.blogspot.fr/…/how-to-solve-problem-of-dependent.html

  29. enable to see items says:

    Hello, after installation of the solution (CRM 2011 online) Within the solution, I choose a entity, then I'm able to choose a primary picklist and a related picklist but no items are visible in order to make the mapping !! Can you help please?

    Thanks, Raynald from France

  30. Graeme Donnell says:

    Hi,

    What rollup/s is this solution supported against does anyone know?

    Thanks

  31. Compatibility to CRM 2013 RTM says:

    Hey,

    I tried installing this solution in CRM 2013 RC1 and RTM, but in both I can´t see the options.

    So I can choose an Enitity and primary/related Picklists, but then the options are missing.

    Can you confirm this in CRM 2013? Maybe it is just a fault for my part.

    Regards

    Patrick

  32. Compatibility to CRM 2013 RTM --> Solved says:

    Hey,

    I was able to solve this on my own.

    You need to set up your Internet Explorer to Browser Mode IE8 and Document Mode to "IE8 Standards".

    Just hit F12 on your CRM-Site to get access to these options.  

    This is only relevant for the Setup, End Users don´t Need to Change anything.

    Works like a charm.

    Patrick

  33. Brett says:

    This was working perfectly, but then the option vanished from my Sitemap. I tried uninstalling, but having some difficulties with that. Any idea on how to restore to my sitemap to access it again?

  34. Oliver says:

    Patrick you god! I spent a week tackling this and giving up – I was about to hand edit the XML for 500+ items when I came across your post. Thank you so much!!

    >Hey,

    >I was able to solve this on my own.

    >You need to set up your Internet Explorer to Browser Mode IE8 and Document Mode to "IE8 Standards".

    >Just hit F12 on your CRM-Site to get access to these options.  

    >This is only relevant for the Setup, End Users don´t Need to Change anything.

    >Works like a charm.

    >Patrick

  35. Mathew Joseph says:

    Thanks for this solution. I have a bit more demanding form.

    I have 4 sets of drop down.

    Service:                     Resource:

    Complaint Type1:    Complaint Type1Step2:

    Complaint Type2:    Complaint Type2Step2:

    Complaint Type3:    Complaint Type3Step2:

    Is there any solution for this problem?

    My Service : Resource: dropdowns are working fine with this code. But I have more dropdowns in the form

    Mathew

  36. Sales Support says:

    Is this solution available as unmanaged? Because in CRM 2015 you can't install it and when you update from crm 2011 to crm 2015 with the installed managed solution there is an error because in the script "getserverurl()" is not supported any more. Script has to be updated to "getClientUrl()".

  37. User says:

    The dependent picklists in not coming out below Dynamics Marketplace