CRM 2013 – Asynchronous Solution Import

The new Dynamics CRM 2013 SDK includes a new method to execute service requests asynchronously which currently only works for asynchronous solution imports at the time of this writing. The main benefit of an asynchronous solution import is that there is less of an effect on users who are interacting with the system when the solution is being imported. Previously, users would get locked out and would experience a SQL Server error during import.

The following code snippet can be used to execute an asynchronous solution import in CRM 2013.

var connection = new CrmConnection("Crm");

var service = new OrganizationService(connection);

var context = new CrmOrganizationServiceContext(connection);

IOrganizationService sdk = (IOrganizationService)context;

ExecuteAsyncRequest request = new ExecuteAsyncRequest

{

Request = new ImportSolutionRequest

{

CustomizationFile = File.ReadAllBytes(pathToSolutionFile),

PublishWorkflows = true,

}

};

ExecuteAsyncResponse response = (ExecuteAsyncResponse)sdk.Execute(request);

Enjoy!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s