Dynamics CRM ExecuteMultipleResponse – Analysing the Results

Roshan Mehta, 10 January 2013

To conclude my series on the new ExecuteMultipleRequest as part of the December 2012 release for Microsoft Dynamics CRM 2011, we will take some time to take a look at the information made available within the ExecuteMultipleResponse. This includes the IsFaulted and Responses properties.

I have run an ExecuteMultipleRequest which will create a batch of 1,000 contacts inside CRM, three of which have the birthdate field set to “xx” to force a failure. We can see the following results when we examine the ExecuteMultipleResponse.

Dynamics CRM ExecuteMultipleResponse Analysing the Results

Firstly, we can see that the IsFaulted property is set to “true”. If we take a look at the Responses, we will be able to see which ones failed and why. Rather than go through each of the 1000 responses, I have selected all responses that faulted using the following code:

var faults = response.Responses.Where(r => r.Fault != null).ToList();

 Dynamics CRM ExecuteMultipleResponse Analysing the Results

Inside the faults collection, we can see that there are three faults. Expanding one of the faults displays the RequestIndex which means that item 845 failed to process. If we expand the Fault property and drill down into the InnerFaults, we will get an accurate description as to the exact error that occurred while creating the record in CRM. Note: If three records have a fault, this does not mean that all 1,000 contacts failed to create. 997 contacts will exist in CRM as long as the ContinueOnError property of the ExecuteMultipleRequest is set to “true”.

 Dynamics CRM ExecuteMultipleResponse Analysing the Results

Notice how the Message property shows that we are setting the “birthdate” field incorrectly on some of the Contacts. We can then fix the problematic contacts and then attempt to create the records in CRM again.