locked
Error when executing workflow on multiple records RRS feed

  • Question

  • Hi everyone,

    I have a scenario where I create custom entitiy records using a workflow. Upon creation of the records, a plug-in is triggered, which is doing calculations with the data. My problem is, when I use the workflow on multiple records (about 50), some of the records are stuck in a waiting state and are never created. In the system job screen, I only see a generic error message, which didn't help much.

    My first guess was to register the plugin in asyc mode, but it didn't help (now the workflow executes correctly, but the plug-in code fails on some of the records - the code works properly with the same data but fewer records).

    So my guess for the problem is that the sandbox processing service is not fast enough to process the data, so it "throws away" some of it.

    I am open to suggestions to resolve this issue, or to discuss other ideas what could be causing this problem.

    Regards,

    Adam

    Friday, September 6, 2013 1:57 PM

All replies

  • Hi Adam,

    It could be that the sandbox process is timing out if there is some resource contention going on that locks the workflow - but I think it is more likely that there is an exception coming back from your Plugin that fails the workflow.

    Use the CrmDiag tool to run a trace whilst the problem occurrs to get the full exception. http://crmdiagtool2011.codeplex.com/

    It's a it of a pain having to wade through it all - but you could first try only logging exceptions (Verbosity setting in the diagtool) and see if you see the problem.

    hth,

    Scott


    Scott Durow
    Blog www.develop1.net    Follow Me
    Rockstar365
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Friday, September 6, 2013 5:21 PM
    Answerer
  • Hi Adam,

    I think there is some error in your plugin because of which it is failing. 

    Would you please post the error that you are getting? What operation you are doing in the Plugin? What is execution mode of your plugin?

    Hope this helps!

    Thanks!

    Saturday, September 7, 2013 5:18 AM
  • Hi KalimK!

    My complete error is:

    System.ServiceModel.CommunicationObjectFaultedException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #D913E480

    Plugin Trace:

    [Microsoft.Xrm.Sdk.Workflow: Microsoft.Xrm.Sdk.Workflow.Activities.CreateEntity]
    [CreateStep1: Előkészített számla létrehozása]


    [Plugins: Plugins.PostElőkészítettszámlaCreate]
    [78f95977-3906-e311-95c2-d4ae52c60983: PostElőkészítettszámlaCreate]




    Error Message:

    Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.ServiceModel.CommunicationObjectFaultedException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #D913E480Detail: 
    <OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
      <ErrorCode>-2147220970</ErrorCode>
      <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
      <Message>System.ServiceModel.CommunicationObjectFaultedException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #D913E480</Message>
      <Timestamp>2013-09-06T13:03:27.6895068Z</Timestamp>
      <InnerFault i:nil="true" />
      <TraceText>[Microsoft.Xrm.Sdk.Workflow: Microsoft.Xrm.Sdk.Workflow.Activities.CreateEntity]
    [CreateStep1: Előkészített számla létrehozása]


    [Plugins: Plugins.PostElőkészítettszámlaCreate]
    [78f95977-3906-e311-95c2-d4ae52c60983: PostElőkészítettszámlaCreate]

    </TraceText>
    </OrganizationServiceFault>
       at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Create(Entity entity, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)
       at Microsoft.Crm.Extensibility.InprocessServiceProxy.CreateCore(Entity entity)
       at Microsoft.Crm.Workflow.Services.CreateActivityService.<>c__DisplayClass1.<CreateInternal>b__0(IOrganizationService sdkService)
       at Microsoft.Crm.Workflow.Services.ActivityServiceBase.ExecuteInTransactedContext(ActivityDelegate activityDelegate)
       at Microsoft.Crm.Workflow.Services.CreateActivityService.ExecuteInternal(ActivityContext executionContext, CreateEntity createEntity)
       at Microsoft.Crm.Workflow.Services.CreateActivityService.Execute(ActivityContext executionContext, CreateEntity createEntity)
       at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
       at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

    My fist guess was also a plugin error. However, if I run the workflow on the same records but in smaller sets, the plugin executes fine. That's why I guess the error has something to do with the amount of records, not the actual records. I will try to use CrmDiagTool to find out more. The plugin is running post-operation on create of a custom entity (synchronous).

    Regards,

    Adam

    Monday, September 9, 2013 6:49 AM
  • Hi Adam

    I think the error is related to using of global service variable.

    Look into the below url, it may help you.

    http://www.mindfiresolutions.com/Invalid-Pointer-error-in-Custom-workflow-In-MS-CRM-2488.php


    Thanks, MS CRM Consultant, Ranjan

    Monday, September 9, 2013 7:37 AM
  • Hi,

    Yes, this is just the ORganizationServiceFault that is coming from the Create method call - you need to find the details of this exception that will be in the CrmDiagTool trace.

    Scott


    Scott Durow
    Blog www.develop1.net    Follow Me
    Rockstar365
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Monday, September 9, 2013 7:38 AM
    Answerer
  • Hi Adam,

    Please Post the error that you are getting. Would you please post the plugin code as well?

    Thanks!

    Monday, September 9, 2013 7:57 AM