locked
CRM 2011 - Workflow registered to start when an E-mail is created fails because the user didn't provided a subject RRS feed

  • Question

  • Hi All,

    I have an issue with a workflow that is supposed to run when a new E-Mail record is created. This happens when an email is tracked to CRM from the Outlook client (all of our users use the Outlook client). However the workflow will not run when the Subject field of the email is left blank by the user. The workflow is very simple:

    1.      Set email status to draft

    2.      Copy the created date field to another field

    3.      Set the email status to sent

    Viewing the workflow progress (Process Progress) showed that the error occurred on the first step and was:

    “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.”

    The trace logs for the Asynchronous Processing service (‘CrmAsyncService(Server’ in log file name) had the following entries:

    >CrmSoapExtension detected non-CrmException - report will be sent to Watson:
     System.InvalidOperationException: There was an error generating the XML document. ---> System.ArgumentException: Property value must be non null.
     ...
     >Crm Exception: Message: An unexpected error occurred., ErrorCode: -2147220970
     ...
     >Web Service Plug-in failed in SdkMessageProcessingStepId: {FE0C03A3-F537-451D-9CD1-CC98641B0A5B}; EntityName: email; Stage: 50; MessageName: SetStateDynamicEntity; AssemblyName: Custom.Crm.Audit, Custom1.Crm.Audit, Version=1.0.0.2, Culture=neutral, PublicKeyToken=e86f6c07b0fe8025; ClassName: Custom.Crm.Audit; Exception: Unhandled Exception: System.Web.Services.Protocols.SoapException: Server was unable to process request.Detail: 
    <detail><error>
       <code>0x80040216</code>
       <description>An unexpected error occurred.</description>
       <type>Platform</type>
     </error></detail>
     ...
     >Crm Exception: Message: An unexpected error occurred., ErrorCode: -2147220970, InnerException: Microsoft.Crm.CrmException: An unexpected error occurred.
     ...
     >Workflow terminated: {ED96C786-531A-432A-BF50-51AD85ABEFAA} - System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: An unexpected error occurred. (Fault Detail is equal to Microsoft.Xrm.Sdk.OrganizationServiceFault)., AsyncOperationId: {82623BC6-8E00-E111-A6D3-00155D05CD0C}
     ...

    I think the key here is the ‘Property value must be non null.’ entry. In our case we can see that only emails that are missing a Subject are failing. For the email entity the Subject field is the primary field, as such I guess the CRM services has trouble dealing with any email instance that is missing data in this field. I did notice that the status of the email is set to ‘Open’ even though the step failed which suggests that it is some post action step that is failing. Perhaps someone can shed some light on this.

    (BTW: I have seen similar behaviour when trying to delete an Account record that was created without an account name. In this case the trick is to give the account a name, save the account then delete it.)

    I considered setting the Subject field to be mandatory but this doesn’t roll through to Outlook so this will not stop the users from tracking e-mails that don’t have a Subject.

    I could use a workflow to set the Subject field to a default value of ‘<no subject>’ when a subject is not supplied. However, I first need to set the e-mail record status to draft before I can update the subject field, so I’m back to the original issue.

     

    Does anyone have any suggestions of how I can resolve this?

    Is this a bug or is this by design?

     

    Environment:

                   CRM 2011 Rollup 4 running on a local Windows Server 2008 R2 VM

                   SQL Server 2008 R2

                   All the users are using the CRM 2011 Outlook Client Rollup 4 on Office 2007

    Thursday, October 27, 2011 2:52 PM

Answers

  • I've managed to resolve this by creating a small plugin that sets the subject to <no subject> if the subject line is empty.

     

    I would still like to know if the issue with not providing values for the primary field of an entity is a bug or not.

    I would have thought that if this was a requirement the system would of insisted that these fields were mandatory. 

    • Marked as answer by Mark.Cherry Wednesday, November 2, 2011 2:41 PM
    Friday, October 28, 2011 12:14 PM