Dynamics CRM, Email, Workflow

Fix: Microsoft.Crm.CrmException: Cannot create the given type without the required parameters.

If you use CRM workflows to create and send notification emails you may come across this error, usually after just having changed the workflow definition in some way:

Microsoft.Crm.CrmException: Cannot create the given type without the required parameters

The full ungodly error message will be something like:

Plugin Trace:
[Microsoft.Crm.Workflow: Microsoft.Crm.Workflow.Activities.EvaluateExpression][EvaluateExpression]
Error Message:
Unhandled Exception: Microsoft.Crm.CrmException: Cannot create the given type without the required parameters.
at Microsoft.Crm.Workflow.Services.ExpressionServiceBase.CreateCrmType(WorkflowPropertyType type, Object[] values)
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)

When does it happen?

This message has been driving me crazy. Complex workflows that were working perfectly well one minute break after making insignificant changes. At work we have so many workflows sending notifications that even the thought of changing some of them can bring me out in a cold sweat. This is because the only way I knew of to fix them when they break was to rebuild whole branches of quite complex workflows. Not. Funny.

This happened again today and I did a bit more digging. I now have a slightly better understanding of the issue. I don’t know how to fully fix the issue – but I do have a better approach now than rebuilding whole workflows, branches of logic or the email step.

The issue happens when you change the From, To, CC or BCC fields

It’s possible there are are other scenarios where you’ll get this message – but if you’ve just changed say, the recipient list of the email – then there is a very good chance that this is the problem.

How do I fix it?

In all the cases I’ve experimented with, I didn’t need to delete the whole workflow or even the email step. This was the approach I had been using but it turns out its overkill.

Given that the problem is something to do with the workflow engine being unhappy with the From, To, CC, or BCC fields – all you need to do is reset the values in those fields and force a save. The approach I’m currently playing with when making a change is:

  1. Remove all values from the field you are changing. So if you are changing the To list – delete everything from it.
  2. Save the workflow and close it. You might even consider Activating it though I’m not sure if this is necessary
  3. Reopen the workflow and set the field to the intended value
  4. Save and activate

If you clear everything out and save the workflow – then come back and correct it – the issue doesn’t seem to occur.

It’s still not the most awesome user experience but I hope this saves at least someone from destroying their workflow just for the sake of one corrupt field!


18 thoughts on “Fix: Microsoft.Crm.CrmException: Cannot create the given type without the required parameters.

  1. Thanks for your post! You saved me a lot of frustration and time I would have spent troubleshooting. I had to tweak my email recipients for awhile before I got the workflow to work, and it ended up working with the same settings that triggered the error in the first place! Go figure…

    1. No problem. We’ve been getting away with removing all the recipients, saving and reopening. I’m pretty sure you don’t need to activate the workflow afterall

  2. Wooof….this was hard nut to crack…thanks a lot for this suggestions…spent hours and hours after this issue..should have searched google first 🙂

  3. if workflow start working after applying this steps then how to stop that emails which were in waiting status because of that workflow.

    1. I can’t remember the specifics of what the exact failure behaviour was with this as it was a long time ago.

      However, in general – if the emails were created and are still in a state under which they could be sent, then you could almost certainly identify them via an Advanced Find and delete them.

      Alternatively, depending on the failure scenario its possible the workflow didn’t get as far as sending the emails in which case you may have a large number of system jobs in the waiting state, and they’ll sit there forever. Again, Advanced Find to find the jobs and just cancel each one

      Hope that helps


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