If you are capturing a date in a dialog, it is not possible to assign that value to the crm datetime field. It can be done by creating workflow assembly.

Create a workflow assembly, which takes a string as input parameter and return date as output parameter. Here is code..

using System;
using System.Activities;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Workflow;

namespace DialogDate
{
public class DialogDate:CodeActivity
{
protected override void Execute(CodeActivityContext executionContext)
{

// Create the context
IWorkflowContext context = executionContext.GetExtension();
IOrganizationServiceFactory serviceFactory = executionContext.GetExtension();
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
string sdate = StringInput.Get(executionContext);
DateOutput.Set(executionContext,DateTime.Parse(sdate));

}

[Input(“string”)]
[Default(“10/11/2010”)]
public InArgument StringInput { get; set; }

[Output(“Date”)]
[Default(“01/01/01”)]
public OutArgument DateOutput { get; set; }

}
}

Register the assembly and use it in your dialog.

Call the assembly and pass the date string and use the return value to set the date field as shown in screen shots below.

1 comment

  1. Hi, I do all this steps correctly, and I’ve the custom workflow correctly published. But i don’t know how to do this step: “Call the assembly and pass the date string and use the return value to set the date field as shown in screen shots below”.

    When I click in the “Set Properties” button of my custom workflow, i can’t choose anything. Operator Field is in blank, and if i select de date response of above and click the “add” button, nothing happens.

    I need some help please. ¿Can you describe this final step with more detail? thanks!

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 )

Facebook photo

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

Connecting to %s