locked
The plug-in execution failed because the operation has timed-out at the Sandbox Client. RRS feed

  • Question

  • I have written a plugin that will fetch all the marketing list members against a particular campaign activity and insert new rows for each marketing list member into another entity.The plugin retrieves the dyanamc as well as the static list members.I have more then 10000+ records member against ech campaign activity.

    The plugin is registered in sandbox isolation mode  since i need to run it for mscrm online 2011 and onpremise as well.

    The plugin only works for 500 records and then fails and i get the below error.

    Plugin Trace:

    [TestPlugin: TestPlugin.Class1]
    [afd78e3c-6d3f-e211-a66a-00155d64034b: TestPlugin.Class1: Update of campaignactivity]

     

    Error Message:

    Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: 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: #7D50BC9FDetail:
    <OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
      <ErrorCode>-2147204751</ErrorCode>
      <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
      <Message>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: #7D50BC9F</Message>
      <Timestamp>2012-12-12T05:59:18.0237162Z</Timestamp>
      <InnerFault i:nil="true" />
      <TraceText>
    [TestPlugin: TestPlugin.Class1]
    [afd78e3c-6d3f-e211-a66a-00155d64034b: TestPlugin.Class1: Update of campaignactivity]

    </TraceText>
    </OrganizationServiceFault>

     Please let me know how to resolve this issue.

    Also if the plugin fails for a particular records ,how can i fetch the last record Id that is been inserted so that i can resume the operation.

    Any other work around for this issue.

    Wednesday, December 12, 2012 6:08 AM

All replies

  • Hi,
         There is a restriction on plugins not to run more than 2 mins. Due to this, you are getting the timeout error. In onpremise environment, you can use custom workflows to do the jobs which takes more than 2 mins. However, currently for online crm we don't have support for custom workflows(in the next release we are expecting the support).

         Instead of trying to work on all the records at once, you may to try to do it in a batch. 

    1. In the update plugin of Campaing activity, get all the associated marketing list members guids and keep them as a comma seperated string.  

    2. Lets say u got 10,000 records. You can consider first 100 records(or you can consider any other number) as a batch and create a new custom entity(lets say new_batchprocess) record and keep first 100 records guids string in the record. You can repeat the same for the rest of the records.

    3. You can register a plugin on create of custom entity, retrieve the comman seperated guids and work on each record.

    It may not be ideal but I believe its the only way to achieve your functionality.


    Vikranth http://howto-mscrm.blogspot.com "Please Mark it as answer if it helps in resolving your query"

    Wednesday, December 12, 2012 7:25 AM
  • what does paging do?It works as a batch?
    Wednesday, December 12, 2012 9:06 AM
  • Hi,

    You could also try to register your plugin step as Asynchronous Execution mode.


    I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful !!!
    Vikram !

    Wednesday, December 12, 2012 9:12 AM
  • Paging will allow us to retrieve a specificied number of records at one go instead of retrieving all the records at a time. This is useful when we have large set of records to be retrieved. In MS CRM, we can retrieve maximum of 5000 number of records using Query Expression or FetchXML.

    In your case, you have two things to consider.

    1. Retrieving more number of records(10K+)

    2. Once you are able to retrieve more than 5K records, need to process 10k+ records which takes more than 2 minutes using a plugin(As you are in online)

    For the first one, we have a work around:

    • Click Start, click Run, type regedit in the Open box, and then click OK.
    • Locate and then select the following registry subkey:
      HKEY_LOCAL_MACHINE\Software\Microsoft\MSCRM
    • On the Edit menu, point to New, and then click DWORD Value.
    • Type TurnOffFetchThrottling, and then press ENTER.
    • Right-click TurnOffFetchThrottling, and then click Modify.
    • Type a number other than 0 in the Value data box, and then click OK.

      Note Step 6 lets you retrieve the number of records specified in the Count attribute of your fetch statement.
    • On the File menu, click Exit.

    Source: http://support.microsoft.com/kb/911510

    For the second one, you try the approach which i mentioned in my first reply.

    @_Vikram: Async plugin also has the limit of 2 mins.


    Vikranth http://howto-mscrm.blogspot.com "Please Mark it as answer if it helps in resolving your query"

    Wednesday, December 12, 2012 9:32 AM
  • thanks for the reply..I have already registered the plugin in Asynchronous Execution mode.
    Wednesday, December 12, 2012 10:23 AM
  • Did u try above two steps? Sync or ASync plugin doesn't make any difference in your case.


    Vikranth http://howto-mscrm.blogspot.com "Please Mark it as answer if it helps in resolving your query"

    Wednesday, December 12, 2012 10:57 AM