Category Archives: Customer Engagement
This article describes how to simulate a long operation in Dynamics 365 (CRM) using a simple custom plugin that introduces a delay using the Thread.Sleep function.
Background: recently we have been investigating an issue regarding some timeouts happening in a third party application which connects to our Dynamics 365 service. At the moment, it is difficult to tell if those timeouts are due to some slow connections to Dynamics or other reasons. In order to help us with this investigation, we are going to set the Timeout property of the OrganizationServiceProxy in the client application, which by default is 2 minutes.
Before applying this change, we also want to test it and simulate some long queries that would last longer than the client timeout limit set for the OrganizationServiceProxy. Here is where we have created this simple plugin “DelayOperation” that is going to introduce a delay for a certain number of seconds.
For testing purpose, I have prepared a simple test that creates a Task record. See below the corresponding code:
Then we have registered our “DelayOperation” plugin in the create message of the Task entity, see below this plugin registration step:
Notice we pass the number of milliseconds to be used by the Thread.Sleep function as an unsafe plugin parameter. In our example, the client would wait for 10 seconds and the plugin would delay the operation for 12 seconds, causing the client to timeout.
Finally, our “DelayOperation” plugin code is:
You can download all this code from the following Github project:
I hope you find it useful!
Some great news this week, the new Dynamics 365 (CRM) version 9.0 is already available for trial.
The build version I’ve got with my UK trial ([orgname].crm11.dynamics.com) is 22.214.171.124.03.
You can now enjoy some of the new features that I show below:
- New design:
- New Unified Interface Apps
- Flow Integration
- Multi Select Option Set attribute
- New Solutions Components, including Virtual Entities:
You can find more information about the new features in these Microsoft articles:
Changes for developers:
Enjoy your trial!