Populate Two Options values when creating a record in a dialog


“I have an entity with a field of type ‘Two Options’ that I would like to populate within a ‘Create Record’ activity in a CRM 2011 dialog.   The ‘Two Options’ type in CRM 2011 is a boolean.  The ‘Prompt and Response’ activity in a CRM 2011 dialog only gives me options for Text/Integer/Float.”


“Because of this, I can’t set the value of the answer to the field in the entity  within ‘Set Properties’ because the types don’t match.”



Custom workflow activities to the rescue!  I wrote a very simple workflow activity that converts the integer to a boolean.




Once you have the ‘Two Options’ typed value, you can map it to your field.


The code for the workflow activity is the simplest workflow activity I have ever created:


If you don’t want to build/deploy the code yourself, but just want to use the workflow activity to solve this problem, then you can download an unmanaged solution here:


I also have an end to end example in an unmanaged solution here:


In the end to end example, I went ahead and created a ribbon button that will launch the dialog without having to select an entity in the grid.


I used the User entity trick from http://dkdt.me/KmqxOZ.  In putting together the sample, I was also inspired by http://dkdt.me/KmqwdV.  However, I took a shortcut.  I hard coded the CRM User guid for the ObjectId in the dkdt_/scripts/LaunchModalDialog.js file.  You will need to go into it and update it with an actual user in your CRM org for the sample to work.

If you want the source code for everything, you can grab it here:


NOTE: The code requires the Developer Toolkit for Microsoft Dynamics CRM 2011.



Comments (3)

  1. Cris says:

    You are just amazing. I would have been happy with just the solution of the two option issue, but you went one step further and answered the next question I had and that was launching a dialog without having to be in the entity. Sweet!

  2. Zach Waidelich says:

    Unexpected exception from plug-in (Execute): Workflow.intToBool: System.InvalidCastException: Unable to cast object of type 'System.Activities.InArgument`1[System.Int32]' to type 'System.IConvertible'.

    I'm getting this exception when I'm running the code above any suggestions on what could be wrong?

  3. Zach Waidelich says:

    Never mind just changed it

    if (integerValue == 1)


       boolValue = True



Skip to main content