Introduction 

In this blog, we will see Myth about ExecuteMultipleRequest in Dynamics 365.

Scenario

As a developer, we always want to speed up the performance of our code by using some tool or API but we forget to read all the limitation.

I always thought, Execute Multiple requests will speed up the execution of D365 by running requests in parallel or it has an inbuilt mechanism to improve the service request.

Requirement : Create 1000 records in Dynamics 365 using Plugin Code.

I wrote a plugin to create 1000 records using ExecuteMultipleRequest but most of the time it got some unexpected errors. 

In documentation, Microsoft always recommends to use this request but in real scenario it doe not perform well or throws an error.

Purpose

The purpose is to minimize round trips between client and server over high-latency connections.

Plug-ins either execute directly within the application process or in close proximity when sandbox-isolated, meaning latency is rarely an issue.

What You should know  

On the D365 server side, the operations included in a batch request are executed sequentially and aren’t done in parallel. 

Developers tend to use batch requests in this manner assuming that it will allow for parallel processing. Batch requests won’t accomplish this objective. 

When to Use

When you have an application running outside the Dynamics 365. It can be desktop or web application.

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/guidance/server/avoid-batch-requests-plugin