CRM 2011 – Dialog Date and Time Response type error

I was creating a dialog today and came up  against a very odd and annoying error.  I talk about it in this Hosk CRM Dev video or you can read the blog below.

I was trying to get an response of type Data and Time.  I thought I would be clever and default the time to the current time by using the Process –> Execution time.

Below you can see the values I have used

Dialog enddate error 1

but then when I tried to run the dialog and got this error

Dialog enddate error 2

and below you can see the error which was being thrown

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Expected parameter of type System.DateTimeDetail:
<OrganizationServiceFault xmlns:i="" xmlns="">
<ErrorDetails xmlns:d2p1="" />
<Message>Expected parameter of type System.DateTime</Message>
<ErrorDetails xmlns:d3p1="" />
<Message>Unhandled Exception: Microsoft.Crm.CrmArgumentException: Expected parameter of type System.DateTime
at Microsoft.Crm.Workflow.Services.ExpressionServiceBase.EnsureParameterType(Object parameter, Type type)
at Microsoft.Crm.Workflow.Services.ExpressionServiceBase.EvaluateExpression(ExpressionOperator expressionOperator, Object[] parameters, Type targetType)
at Microsoft.Crm.Workflow.Activities.EvaluateExpression.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Inner Exception: System.ArgumentException: Expected parameter of type System.DateTime

<InnerFault i:nil="true" />
<TraceText i:nil="true" />
<TraceText i:nil="true" />

I couldn’t understand why it was throwing an error.  Logically it didn’t seem to make sense and the error message.

So I thought perhaps if I added one minute to the time this would then work and hey presto it did as you can see below
Dialog enddate error 3


So the moral of this story is, if something doesn’t work add a minute to it and who knows why that works