Update: I was able to reproduce this problem, and have reported it to Microsoft as a bug for resolution. Please vote for it as an important fix so it can be resolved in the next Rollup Update!

Let me tell you a little story about a bug…

I had just completed a complex workflow process in Microsoft Dynamics CRM 2011. The workflow checks a number of conditions and then sends one (of any numerous) email templates to a distribution group filled with dynamic fields from the primary and related entities. It was painstaking created, tested, and modified several times until the conditions and templates were perfect. Then, I simply updated the “To” fields to make it live… But upon the first execution, no email went out and I got the error:

An error has occurred. Try this action again. If the problem continues, check the Microsoft Dynamics CRM Community for solutions or contact your organization’s Microsoft Dynamics CRM Administrator. Finally, you can contact Microsoft Support.

No problem, I thought, I’ll just go back in and mess with the Send Email steps that are failing to figure out what the problem is. But when I went to click the “View Properties” or “Edit Properties” to see/change the created email record, I got a CRM unhandled exception with the following stack trace:

Now I was stuck–I didn’t want to recreate the entire workflow manually and painstakingly test over and over again manually. No one had ever heard of this problem, and I couldn’t find anything online about how to solve it.

To solve it, I exported the workflow and dug through the XAML to find the root of the problem. When I created the Send Email steps in my workflow, I had filled out the “To” and “CC” fields with User accounts for testing purposes. When I modified it to make it “live,” I changed the “To” entity record (to the live distribution list Contact record) and completely cleared the “CC” field. However, for some reason CRM still had a pointer doing and entity record lookup for the “CC” field, and it was failing to look it up because there was no record indicated (the field was blank).

I noticed in the XAML there was a SetEntityProperty in the Send Email sequences that shouldn’t be there for a blank “CC” field. Something like this:

The ActivityReference for SendEmailStep1_1, however, contained a weird stub for an empty PartyList. This was causing the Index out of Range lookup error, which was crashing CRM:

The solution was to remove the offending references to the “CC” field and associated activities. Problem solved! And that’s the last time I use the “CC” field for testing purposes without backing up my workflows first!!!

eimagine is an Indianapolis-area leader in Microsoft Dynamics CRM. Whether you’re looking for an out-of-the-box CRM implementation, and highly customized solution, or an XRM-based extended CRM product, we’re the local company with the expert staff to get it done! Learn about our CRM experience.

Like this post? Share it!