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 the Author Dynatecon Solutions

DYNATECON is a group of dynamic professionals who are passionate about building affordable IT solutions using Dynamics 365 and Power platform. We focus on enabling digital transformation in Small scale as well as Medium scale industries. Whether you have 1 user or 100 users and planning to implement a new CRM system, please contact us at info@dynatecon.com. We can guide you for sure!

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 )

Google photo

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

Connecting to %s