How to set Date fields in MSCRM 2011 Dialogs

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);


public InArgument StringInput { get; set; }

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.


About Dynamics CRM Guru

We are a group of CRM Consultants and have significant experience in transforming businesses in the right way. We use this platform to share our knowledge which might help many others in the digital transformation journey. We are happy to help you if you are looking for any assistance in CRM implementation projects.

Posted on July 27, 2011, in Microsoft CRM 2011, Microsoft Dynamics and tagged . Bookmark the permalink. 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: Logo

You are commenting using your 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

%d bloggers like this: