The tutorial by Microsoft is very useful, but I wanted to create one in my own words with a few more images to hopefully help newer members of the Dynamics community. I’ve not included the code in this blog in case Microsoft update the MSDN article with newer versions of the code.
In this example, I will be making a cascading drop down between the out of the box businesstypecode field and a new custom field called new_businessspecialisation.
The code Microsoft provided uses JSON to manage the parent child relationships, this works well & is easy to create, but might become time consuming if the field values change regularly. It may be worth investigating whether there is another way to do this that provides the user with a front end to manage the relationships, but that was beyond the scope of this work.
The JSON file will need to be uploaded as a web resource (of type JScript). The code provided by Microsoft will also need to be uploaded as a web resource.
Once the web resources have been created you will need to define the Form On Load functionality, to this simply add the library, enter the function name and pass in the name of your JSON file into the parameters. The script provided by Microsoft this will then concatenate this into a URL to load the source from.
Once the Form On Load event has been created you will then need to create the On Change event for the parent field. This time you will need to pass in the name of the parent field & the name of the child field. In the Microsoft example they do this another as they have an extra level.
Once this has been done, everything should be good to go. The next couple of images show the functionality in action.
Overall, thanks to the Microsoft sample code this proves to be a relatively simple piece of functionality to add that potentially provides a lot of value to the end user.
Share onTwitter Facebook LinkedIn
Leave a comment
Your email address will not be published. Required fields are marked *