In today’s blog, we will go through the steps needed to use the ExecuteMultipleRequest message, in order to perform bulk retrievals from CRM. Using the message ExecuteMultipleRequest is particularly useful in situations when you want to perform multiple queries and avoid making multiple calls to Microsoft Dynamics 365. This technique yields superior performance over individual request processing only when the request is sent over the wire to the CRM Web Service (e.g. Integration, Service, WPF or Console application). The usage typically does not perform well when utilized in plugin code.
This code will generally be part of your existing class in your project in a Visual Studio solution or as within a wrapper class written to encapsulate this functionality for reusability across multiple projects.
1. Build the RetrieveMultipleRequest(s).
2. Add the requests to an OrganizationRequestCollection.
3. Build the ExecuteMultipleRequest.
4. Perform a service call to CRM with the IOrganizationService.
5. Parse the results.
That’s all there is to it! Dynamics 365 is smart enough to send back responses in the same order as the requests were made. To get more tips like this one delivered directly to your inbox, make sure you subscribe to our blog!