Brad Sturgess
Brad Sturgess

Reputation: 151

Dynamics CRM - dynamic dependant optionsets

I need some help figuring out how to go about setting 3 tier dependent option sets for Dynamics CRM.

I am currently using the Dependent Optionset from SDK sample.

The issue is that i have 3 field option sets the the parent, child and the sub child and using the SDK sample is all fine until the sub child options changed based on the parent and the child. Here is an example if i'n not explaining it very well.

Say parent has the options A, B, C, D. Child has 1, 2, 3, 4 and sub child has i, ii, iii, iv.

now if

but if

As you can see from the example, the SDK sample code doesn't cater for filtering the sub child option set which is dependent on not only the child but the parent field as well.

Could anyone show me a way how to accommodate this requirement or lead me to sources that will help me with it?

Upvotes: 1

Views: 588

Answers (1)

MSDN sample is fine for cascading dropdown, but your scenario is not regular cascading.

I recommend this Another approach

This will be easily to maintain & it uses custom entity for configuration not xml. You have to tweak the queryPart to include your conditions (like parent picklist condition also) so that the options to be listed can be populated based on config. If needed you can customize the config entity to include extra conditions.

//define the query for the Option Set Value entity
var queryPart = "/wf_optionsetvalueSet?$select=wf_label,wf_OptionSetValue&$filter=(wf_ParentOptionSetSchemaName eq '" + parentOptSet + "') and (wf_ParentOptionSetTriggerValue eq " + selectedParentOption + ")";

For this solution, I decided to store the pick list options in a custom entity, instead of an XML web resource. Additionally, I created a single dynamic function that could be used to retrieve the appropriate pick list options at run time as each successive “parent” pick list value changed. This allows us to call the same code for any number of dependent pick lists.

The entire solution uses a single custom entity and a static piece of javascript code implemented as a web resource. Modifying the dependent pick list configuration is done simply by updating the Option Set values in CRM and then entering a corresponding record in the customer entity; all native CRM functions. No additional code required.

Upvotes: 0

Related Questions