"The operation has timed out " Exception on Plugin Account when changing the owner of an account RRS feed

  • Question

  • Hello all,

    I have a problem when I change the owner of a certain account, "The operation has timed out " Exception.

    There is a plugin account with PreAssign event who modify the ParentAccount of all the child accounts to NULL, a Post Assign who restore the ParentAccount of all the child accounts to Current account, a PreUpdate event who will execute before its ParentAccount will be changed.

    When I change the owner of account A, the PreAssign event modify the ParentAccount of all the child accounts to NULL (delete the relation bewteen account A and all the child accounts), and PreUpdate event execute on each child account. so it takes serveral minites to finish the whold process. but for this account, i meet the exception "The operation has timed out ". and i found that after PreAssign event deleting the relation of 3 child accounts, the plugin stopperd and throw this exception as following

      Process name: w3wp.exe 
    Exception information: 
      Exception type: InvalidPluginExecutionException 
      Exception message: The operation has timed out 
    Thread information: 
      Thread ID: 24 
      Thread account name: AUTORITE NT\SERVICE RÉSEAU 
      Is impersonating: False 
      Stack trace:  at PluginAccount.PreAssignAccount.Execute(IPluginExecutionContext context)
      at Microsoft.Crm.Extensibility.PluginStep.Execute(PipelineExecutionContext context)
      at Microsoft.Crm.Extensibility.Pipeline.Execute(PipelineExecutionContext context)
      at Microsoft.Crm.Extensibility.MessageProcessor.Execute(PipelineExecutionContext context)
      at Microsoft.Crm.Extensibility.InternalMessageDispatcher.Execute(PipelineExecutionContext context)
      at Microsoft.Crm.Extensibility.ExternalMessageDispatcher.Execute(String messageName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, PropertyBag fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
      at Microsoft.Crm.Sdk.RequestBase.Process(Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
      at Microsoft.Crm.Sdk.RequestBase.Process(CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
      at Microsoft.Crm.Sdk.CrmServiceInternal.Execute(RequestBase request, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
      at Microsoft.Crm.Sdk.InProcessCrmService.Execute(Object request)
      at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.ExecuteInternal()
      at Microsoft.Crm.Application.Platform.CommunicationListeners.AssignRouteOnCreateUpdateListener.AssignEntity(Entity entity, LookupValue owner)
      at Microsoft.Crm.Application.Platform.CommunicationListeners.AssignRouteOnCreateUpdateListener.AssignRouteEntity(Entity entity, LookupValue owner)
      at Microsoft.Crm.Application.Platform.CommunicationListeners.AssignRouteOnCreateUpdateListener.HandlePostEvent(PlatformCommand command, Response response, Boolean wasForUpdate)
      at Microsoft.Crm.Application.Platform.CommunicationListeners.CommunicationListener.HandlePostEvent(PlatformCommand command, Response response)
      at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.ExecuteInternal()
      at Microsoft.Crm.Application.Platform.ServiceCommands.UpdateCommand.Execute()
      at Microsoft.Crm.Application.Platform.EntityProxy.Update(Boolean performDuplicateCheck)
      at Microsoft.Crm.Application.Platform.EntityProxy.Update()
      at Microsoft.Crm.Application.Forms.AppForm.HandleFormEventAssign(Boolean gridRefreshCallbackAdded)
      at Microsoft.Crm.Application.Forms.AppForm.RaiseDataEvent(FormEventId eventId)
      at Microsoft.Crm.Application.Forms.EndUserForm.Initialize(Entity entity)
      at Microsoft.Crm.Application.Forms.CustomizableForm.Execute(Entity entity, String formType)
      at Microsoft.Crm.Application.Forms.CustomizableForm.Execute(Entity entity)
      at Microsoft.Crm.Web.SFA.AccountDetailPage.ConfigureForm()
      at Microsoft.Crm.Application.Controls.AppUIPage.OnPreRender(EventArgs e)
      at System.Web.UI.Control.PreRenderRecursiveInternal()
      at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    the opreation changing the owner works well on the other accounts and il works in another environment of test.

    i also tried to modify the executionTimeout in the web config, but il doesnt works

    thanks for somes ideas

    Friday, June 3, 2011 8:28 AM


All replies

  • Do you have many child accounts? I mean, do you expect you plugin to take long time in some situations?


    If so, you might not be able to use a synchronous plugin but will need a custom workflow activity (which is the only custom logic that is not bound to timeouts).

    Can you provide the code of your plugin too?

    Gonzalo | gonzaloruizcrm.blogspot.com

    Friday, June 3, 2011 12:09 PM
  • Hello, Gonzalo

    Yes, this account has 20 child accounts.

    In the envrioment test, i have an account whos have 40 child accounts and this takes about 2 minuites.



    Friday, June 3, 2011 1:06 PM
  • That goes over the allowed timeout for plugins. I'm afraid you need to implement it as an asynchronous process using a custom workflow activity: http://msdn.microsoft.com/en-us/library/gg309745.aspx

    You should be able to reuse most of the code, just need to change the interface so it becomes a workflow activity instead of a plugin

    Gonzalo | gonzaloruizcrm.blogspot.com

    Friday, June 3, 2011 1:33 PM
  • Hello,

    But the workflow can only replace the part of code post event, for the code of pre-event, workflow can not be trigged before the user change the owner. am I rignt?

    what's more, the problem is in the execution of pre assign event.


    Monday, June 6, 2011 3:08 PM
  • Correct, workflow cannot be triggered for pre-validation.

    However, if your plugin does some pre-validation that is taking longer than 1 minute then you should consider a different design.

    Gonzalo | gonzaloruizcrm.blogspot.com

    Monday, June 6, 2011 3:31 PM