Saturday, December 12, 2015

Dependent (Linked) OptionSets in Dynamics CRM 2015

I recently used the sample code provided in the SDK that allows you to have multiple OptionSets linked together so that selecting an item in the first OptionSet will filter the items appearing in the second. 

https://msdn.microsoft.com/en-us/library/gg594433(v=crm.7).aspx

There was an error in the instructions for configuring the OnLoad event on the form. It says to use

"sample_TicketDependentOptionSetConfig.xml"

 as a parameter.  That's wrong. You need to use 

"sample_TicketDependentOptionSetConfig"

The SDK.DependentOptionSet.init function in the JavaScript file I modified slightly to support multiple languages.  The first few lines now read

//Retrieve the XML Web Resource specified by the parameter passed var clientURL = Xrm.Page.context.getClientUrl();

var userLcid = Xrm.Page.context.getUserLcid();

var pathToWR = clientURL + "/WebResources/" + webResourceName + "_" + userLcid;




The data files were then appended with the relevant LCID for each language 

e.g. "sample_TicketDependentOptionSetConfig_1033.xml"

A very cool and easy to use JavaScript Library. Thanks Microsoft. 

No comments: