If you were to imagine a custom form in Microsoft Dynamics CRM where you could select any entity and any field on that entity you would realize a few things about option sets.
To enter and support every entity and field would be a daunting and impossible task. Even if you were to spend the time tackling the previous hurdle, any customizations you made to those entities would have to be tracked and re-applied in the option sets, thereby duplicating your workload. Option sets do not inherently support dynamic lists.
This example still relies on the idea that you will have pre-filled the option set with all the possible options and then will remove the ones you no longer want.
You will then be asked to choose the form you want to load from, and the specific field in that form you would like to load options from. Display type After you have chosen which options to load in your Dynamic field, you can choose to display those options in a dropdown menu, a set of radio buttons, a set of checkboxes, or a list. It will not store a value, so this field type is not available in View or email options. Dynamic List fields are designed to use conditional logic based on a parent Dynamic field. It should be set to use the same form that the parent field uses.
This really wasn't a viable solution for what we were trying to do either. The solution we came up with was to utilize single line of text fields hidden on the form to store the values for our option sets.
We'll demonstrate this with one mapping field. So let's start by setting up our form.
Select Option Dynamic Using PHP Mysql
If you do plan on implementing this there are places where refactoring should be performed and efficiency improved. After we've received the XML response back from the request, we loop through each attribute node in the what platforms are there for binary options and use XPath statements to grab both the display and schema name.
Finally, we create option elements, fill out their value and text attributes and add it to our option set.
Now that we have a helper method, which will populate our control, we need to call it from an event and pass it a value. For this example, we'll utilize the onLoad functionality of our form and hardcode the value lead to be passed to our helper method. Then we ensure the dropdown field is set to the default blank option.
Since this isn't a real option set as far as CRM is concerned, it won't pass back any value.
Dynamic Option Answers
It is now just a friendly storage site on your form. There's one piece of the puzzle left and that's how to handle when the page loads. If we were to load the page as it exists, our hidden field would contain the schema name of our attribute, but the dropdown would only have the default value selected.
There you have it. Happy CRM'ing!