I’ve seen a number of people using CRM 2011 Dialogs run into the issue of not setting your data type on a Prompt and Response. Before I get too far, if you haven’t looked at Dialogs in CRM 2011 jump over here and watch this video first before you continue. The scenario we are talking about here is imagine if you have a OptionSet on an entity and you want to collect a value from a user running a Dialog and set the OptionSet value on the entity from the response of the user. For our discussion imagine if you created a FavoriteColor option set on Contact and you are updating it by running a dialog that person running the dialog can collect the contacts favorite color. So I probably have a Page in my dialog that has a Prompt and Response that looks something like the following :
Next, I setup the response detail and choose a response type of Option Set. First of all, don’t confuse choosing Option Set here with anything to do with the Contact entity that has a real OptionSet attribute on it for the contacts favorite color. There is not currently anyway that you can pull those values and reuse them here to avoid duplication. Trust me I’ve suggested that be changes so hopefully we will see it in the future where you can simply reuse the values!
Notice that the Data Type is set by default to Text. This is where a lot of people fail to make the important change. You must set this to integer if you want to have any luck ever assigning the value collected to an OptionSet field on an entity. Another great reason to make sure you change it right away is the fact that you can’t change it after the prompt and response is saved unless you delete it and start over. You have been warned!
In the mean time you need to setup your favorite colors using the Response Values section of the form as you can see below.
So for our example we’ve added Red, Green and Blue or RGB! The Value field on the right is really important if you are trying to collect values that will be used to set OptionSet values on an entity if that is the case these values must match the values of the attribute OptionSet. So for example they may be like 100,0001 or some large number to keep them unique if that is the case you MUST use the same values here if you ever expect it to work.
Once you take care of those two things using Dialogs to collect OptionSet values is possible. Hopefully in the future Dialogs will be enhanced so we can reuse the OptionSet values from the global definition.
What other features would you like to see Dialogs have?