Following on from my previous Dynamics 365 post about getting optionset data from CRM to use in drop down lists in HTML forms we can use the previous piece of code that created a small workflow plugin. To do this you will need to create an Action in CRM. An action is really just a type of workflow except it makes it really simple to call it from external code. It can do everything a workflow can do except we control when its triggered, but it can include input variables and output variables.
First create a new action in Dynamics 365. This is done under the settings menu in the Process list.
Give the action a descriptive name as this will used to call it from JavaScript in later steps.
In this example we are reading all the optionset values for the IndustryCode field in the Account entity, but any entity/field combination can be substituted.
Next create another step that will assign the output from the previous step to a variable called Values. This is created in the process arguments step of the action.
The action needs to be activated and this step is done.
In the next article I will show how easy it is to display these values in a HTML form embedded in a CRM form.