locked
MCRM Online 2013: The plug-in execution failed because the operation has timed-out RRS feed

  • Question

  • Hi everyone,

    We are using Dynamics CRM Online.

    I have a custom workflow (of Marketing List) that  transfer Contacts to another external web application via the web services provided by 3rd party.  However, when there are more than 5000 contacts in the marketing, MSCRM will throw time out error.  I believe that the external web services work fine but it needs times to process contacts in the marketing list one by one.  Is there any way to prevent time out of plugin?  Any help is highly appreciated.

    Thanks in advice.

    Gary

    The plug-in execution failed because the operation has timed-out at the Sandbox Client.
    System.TimeoutException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #1E36D025
    
    Plugin Trace:
    
    [SamplePlugins: Microsoft.Crm.Sdk.Samples.CopyMarketingListActivity]
    [SamplePlugins (0.0.0.0): Microsoft.Crm.Sdk.Samples.CopyMarketingListActivity]
    
    Error Message:
    
    Unhandled Exception: Microsoft.Crm.CrmException: The plug-in execution failed because the operation has timed-out at the Sandbox Client.
    System.TimeoutException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #1E36D025
       at Microsoft.Crm.Sandbox.SandboxCodeUnit.Execute(IExecutionContext context)
       at Microsoft.Crm.Workflow.Services.ProxyCustomActivity.Execute(CodeActivityContext executionContext)


    • Edited by Gary-C Monday, October 13, 2014 9:14 AM
    Monday, October 13, 2014 9:10 AM

All replies

  • Hi Gary,

     Looks like the exception is from your plugin. can you please post the code of Microsoft.Crm.Sdk.Samples.CopyMarketingListActivity? Are you using fetchxml to query the ML?

    Regards,

    Jithesh.K

    Monday, October 13, 2014 9:47 AM
  • Hi,

    Can you please try to register your WF activity Asynchronously?

    Thanks!

    Monday, October 13, 2014 10:09 AM
  • Hi Jithesh,

    Yes.  We use fetchxml within the custom Marketing List On-Demand workflow.  When there are too many contacts in the marketing list (usually > 5000), the workflow will usually be timed-out.  

    The scope of the workflow would be:

    1. Retrieve all contacts from the Marketing List

    2. Transfer each contacts to an external web application via web service

    My fetchxml:

                string fetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>
      <entity name='contact'>
        <attribute name='emailaddress1' />
        <attribute name='mobilephone' />
        <attribute name='firstname' />
        <attribute name='lastname' />
        <attribute name='sg_membershipnumber' />
        
        <attribute name='contactid' />
        <link-entity name='listmember' from='entityid' to='contactid' visible='false' intersect='true'>
          <link-entity name='list' from='listid' to='listid' alias='aa'>
            <filter type='and'>
              <condition attribute='listid' operator='eq' uiname='all' uitype='list' value='{" + strList + @"}' />
            </filter>
          </link-entity>
        </link-entity>
      </entity>
    </fetch>";

    Tuesday, October 14, 2014 2:25 AM
  • Hello Gary,

    There are few settings that you could use to improve your timeouts.

    http://blogs.msdn.com/b/crminthefield/archive/2011/06/13/microsoft-dynamics-crm-timeout-settings.aspx

    But your issue is that you are calling the fetch inside the plugin, iterating thru the list, and passing the value into an external webservice. all this needs time.

    A synchronous plugin will timeout before that. Can you please try to change the Execution Mode of your plugin to Asynchronous to see if it helps?

    Tuesday, October 14, 2014 3:00 AM
  • Hello Garry,

    Plugins (both sync and async) are not supposed to be long-running processes and therefore there is a 2 minute timeout.

    Please go with Async Workflow (Not real time). There will not be such restriction with Async Workflow.

    Thanks!

    If this post helps you, please click "Mark As Answer" on the post and "Vote as Helpful"

    Tuesday, October 14, 2014 5:03 AM
  • Hi CRM,

    Gary's issue is that plugin triggers a workflow. But the plugin is not getting enough time to load the results, iterate thru the results and fire that many child work flow jobs. I am not sure how changing the workflow to async helps.

    Actually the optimum solution would be to remove the actual work from plugin. Use a distribute workflow activity for a marketing list.

    I think this is what needs to be done.

    1. modify the http://crm2011distributewf.codeplex.com/ to execute for a marketing list ( I have the source code. Posted here http://crm2011distributewf.codeplex.com/discussions/354214)

    2. create a ondemand parent workflow that distributes workflow activity to child workflows(invoke the custom workflow (of Marketing List) that  transfer Contacts to another external web application)

    Execute the parent workflow that runs on a marketing list in step 2 from the plugin.

    this way, the entire fetch and related overhead is removed from plugin.

    Please let me know If you wish me to share the code in step1.

    let me know if you need any clarifications

    Regards,

    Jithesh


    Tuesday, October 14, 2014 5:37 AM
  • Hi Jithesh,

    It makes sense, That is why i have recommended to replace plugin with custom workflow activity.

    Thanks!

    If this post helps you, please click "Mark As Answer" on the post and "Vote as Helpful"

    Tuesday, October 14, 2014 5:57 AM