Kunal Goel
Kunal Goel

Reputation: 3637

Custom Workflow: timed-out at the Sandbox Client.System.TimeoutException

Currently we are working on CRM 2015 Online, we have a requirement to backfill a field, “new_UniqueNumber”. For that we have written a custom workflow (OnDemand|Async.). The WF expects to retrieves 3500+ records in a single go (considering RetriveMultiple limit 5000).

The WF only works for around 1600 records and then breaks into TimeOut exception :

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.
at Microsoft.Crm.Sandbox.SandboxCodeUnit.Execute(IExecutionContext context)
at Microsoft.Crm.Workflow.Services.ProxyCustomActivity.Execute(CodeActivityContext
executionContext)

Also, Instead of trying to work on all the records at once, we tried to do it in a batch (i.e. limiting query.PageInfo.Count) and using paging, but this didn’t helped.

What do you think?

Upvotes: 1

Views: 1514

Answers (2)

pkr
pkr

Reputation: 1761

Have you tried having two different workflows? One workflow that retrieves the thousands of records, and then invokes a second workflow on each of the records to actually do the work?

Then the 2-minute timeout wouldn't be a problem for the workflow that simply calls a thousand workflows (because they should be created just fine -- but may stay in "Waiting for Resources" for a few minutes), and the timeout should not be an issue for each of the "child" workflows, if each of them completes within 2-minutes of starting.

Upvotes: 0

Andrew Butenko
Andrew Butenko

Reputation: 5446

In case you want just to populate a field why do you use custom workflow activity? Develop simple .Net application or use SSIS for performing that job.

Upvotes: 1

Related Questions