Workflow ErrorCode: -2147220970, InnerException: System.Runtime.Serialization.SerializationException RRS feed

  • Question

  • I have 2 plugins on create of Entity A. One on pre-validate and the other on post create. I also have a workflow created on create-of-Entity A. This workflow has just one step, stop workflow based on attribute value. Use case: Creating a record in Entity A.

    Scenario 1: When I create the record using the native CRM UI, it works fine.

    Scenario 2: When I create the record in a .net application that calls the CachedOrganizationService.Create, I get the following error

    Crm Exception: Message: An unexpected error occurred., ErrorCode: -2147220970, InnerException: System.Runtime.Serialization.SerializationException: Type 'Microsoft.Xrm.Sdk.RelatedEntityCollection' with data contract name 'RelatedEntityCollection:http://schemas.microsoft.com/xrm/2011/Contracts' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.

    If I deactivate the workflow, everything seems fine. This happens on any entity that has a plugin and workflow registered on the same event. The workflow works fine, when the entity does not have a plugin registered.

    Debugging the 2 plugins did not give any errors. The error occurs after the plugins are executed.

    Tuesday, August 5, 2014 6:23 PM