Hi,
So the scenario is as follows:
Field 1 is called Category and it consists of 6 option set values and it has been designed as an Option Set.
Field 2 is called Sub-Category and for every one of the option set values chosen in Field 1, there are a minimum of 5 options they can choose from Field 2.
The data looks like this:
Sewing Machine | Machine 1 |
Machine 2 | |
Machine 3 | |
Machine 4 | |
Machine 5 | |
Thread | Thread 1 |
Thread 2 | |
Thread 3 | |
Thread 4 | |
Thread 5 |
On my form Quote Product and Order Product, how do I allow the user to only see the associating options according to which Category they have chosen. When selecting Sewing Machine, in the Sub-Category only Machine 1 -5 should appear.
At any given time, the user will only have 1 Sewing Machine and 1 Thread meaning its a 1-1 relationship between the Category and Sub-Category field.
Thanks
*This post is locked for comments
Yes, element.value did the trick for me as well.
[quote user="Mitchell M"]For me I had to use optionSet.removeOption(element.value); Thanks for your contribution.
[/quote]For me I had to use optionSet.removeOption(element.value); Thanks for your contribution.
Hi,
You can do using dependable option set, follow this link -
thabisomotloung.wordpress.com/.../dependent-option-sets-in-ms-crm-2015
Thanks Goutam also.
Thanks Aric, I will look into this.
Hi ,
How many option-set value you have in subcategory field ? If you have more than 10 options I would suggest go for OOB dependent lookup.
Here is the sample reference of dependent lookup -
https://www.powerobjects.com/2016/03/15/how-to-use-dependent-lookups-for-dynamics-crm-201320152016/
http://crmadminassist.com/microsoft-dynamics-crm-dependent-lookups/
https://www.youtube.com/watch?v=-3OmgW_MYlM
If you want to use optionset you can also check below reference -
https://msdn.microsoft.com/en-us/library/gg594433.aspx
In addition you can also write simple JavaScript based on your category value and add remove subcategory optionset options.
// Register the function in onchange of your parent optionset function OnChangeCategoryOptions() { var optionSetCategoryVal = Xrm.Page.getAttribute("new_category").getSelectedOption().value; var optionSet = Xrm.Page.ui.controls.get("new_subcategory"); var optionSetValues = optionSet.getAttribute().getOptions(); optionSet.clearOptions(); optionSetValues.forEach(function (element) { if (optionSetCategoryVal == "1") { if (element.value == "831260001" || element.value == "831260002" || element.value == "831260003" || element.value == "831260004" || element.value == "831260005" ) optionSet.addOption(element); else(element.value == "831260007" || element.value == "831260008" || element.value == "831260009" || element.value == "831260010"|| element.value == "831260011" ) optionSet.removeOption(element); } else if(optionSetCategoryVal == "2") { // do same logic } }); }
Did you take a look at Dependent Optionset Generator from Guido Preite:
crmoptionsets.azurewebsites.net
This should allow you to configure what you are looking for.
Hope this helps.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,219 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156