Wednesday, January 30, 2013

ExecuteMultipleRequest Class in MS CRM 2011 SDK in Roll Up 12

there is a great release for MS CRM 2011 developers in UR 12 for MS CRM 2011.
it is ExecuteMultipleRequest, ExecuteMultipleResponse.
This addition to the CRM SDK allows developers to create, update, and delete records in bulk for both on-premise and online deployments.
The following sample shows how to execute the ExecuteMultipleRequest message.
make your eyes open in the below line..
Settings = new ExecuteMultipleSettings()
ContinueOnError = false,
ReturnResponses = true
here you can set if the process should go when there is a error or not. and also if you want a return values...

there is some performance enhanced with this approach...
u sud have latest role ups (mainly RU 12) installed....
// Get a reference to the organization service.
using (_serviceProxy = ServerConnection.GetOrganizationProxy(serverConfig))
    // Enable early-bound type support.
    #region Execute Multiple with Results
    // Create an ExecuteMultipleRequest object.
    ExecuteMultipleRequest requestWithResults = new ExecuteMultipleRequest()
        // Assign settings that define execution behavior: continue on error, return responses.
        Settings = new ExecuteMultipleSettings()
            ContinueOnError = false,
            ReturnResponses = true
        // Create an empty organization request collection.
        Requests = new OrganizationRequestCollection()
    // Create several (local, in memory) entities in a collection.
    EntityCollection input = GetCollectionOfEntitiesToCreate();
    // Add a CreateRequest for each entity to the request collection.
    foreach (var entity in input.Entities)
        CreateRequest createRequest = new CreateRequest { Target = entity };
    // Execute all the requests in the request collection using a single web method call.
    ExecuteMultipleResponse responseWithResults =
    // Display the results returned in the responses.
    foreach (var responseItem in responseWithResults.Responses)
        // A valid response.
        if (responseItem.Response != null)
            DisplayResponse(requestWithResults.Requests[responseItem.RequestIndex], responseItem.Response);
        // An error has occurred.
        else if (responseItem.Fault != null)

 about performance and analysis follow the below links...

No comments:

Post a Comment