CRM 2011 – Dialogs can’t store Dates!

So we writing a dialog this week in CRM 2011, fantastic stuff, it has some great features allow you to show pick lists of options and getting the user to select one.

but it also has some major weaknesses like the fact you can’t store dates in Dialog, you also can’t store

Bit, Date, Lookups

This seems a bit of an oversight, not to mention you can’t use custom workflow on CRM 2011 online

So to get round this we have stored the dates as text and then convert them into dates.  So I need some code to convert Strings into Dates in my plugin and here it is.

                    newPlac.hosk_startdatetext = "20/04/2011";
                    newPlac.hosk_enddatetext = "21/04/2011";
                    DateTime startDate  = Convert.ToDateTime(newPlac.hosk_startdatetext);
                    DateTime endDate = Convert.ToDateTime(newPlac.hosk_enddatetext);

The import part is using the Convert.ToDateTime();  This is overloaded so you can specify the format if you want.

9 thoughts on “CRM 2011 – Dialogs can’t store Dates!

  1. Anze April 26, 2011 / 7:29 pm

    Hey Tom. I just noticed the same problem with CRM2011 Dialogs. I want to see your solution but it seems I can’t see the whole text. It ends with “This is overloaded so yo…”
    Am I missing something?

    Like

  2. Massimo May 10, 2011 / 2:09 pm

    Anze:

    newPlac.hosk_startdatetext = "20/04/2011";
    newPlac.hosk_enddatetext = "21/04/2011";
    DateTime startDate = Convert.ToDateTime(newPlac.hosk_startdatetext);
    DateTime endDate = Convert.ToDateTime(newPlac.hosk_enddatetext);

    The import part is using the Convert.ToDateTime(); This is overloaded so
    you can specify the format if you want.

    Like

    • Hosk August 22, 2011 / 10:59 am

      yes.

      you can use plugins and javascript in CRM 2011 online so the theory and the code above should work.

      Like

  3. KenC January 4, 2013 / 6:36 pm

    I was able to execute a test where a dialog process can update dates IF the corresponding field on the main form is editable and not read-only. If the field on the main form is read-only, then the update of the record via dialog process will not allow the field to update.

    This seems like a defect to me.

    Like

    • Aaron Robinson February 28, 2013 / 10:03 pm

      KenC-
      This is true of workflows as well, not just dialogs. The field must be set as editable at the form level when you create either process type for it to update the field. Once the workflow is written, you can then make the field read-only again.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s