Deployments – Asynchronous Solution Import

solution-mgmt

Introduction:

Often you must have noticed that importing solution often slows down CRM to the extent that it is almost unusable for the period during which the Import action is being processed.

To improve performance, a new request has been introduced in CRM 2013 which supports to importing solutions asynchronously. This is however available only to developers and the Import Solution action from the CRM Interface still locks CRM out for any practical use by CRM users.

For this we need to use ExecuteAsyncRequest which will be executed as an asynchronous process.

Code Sample:

We need to submit this request using Organization Service and the message will submit an asynchronous job to process. You will receive an id of this async job which has been submitted. Through this id you can identify whether a solution has been imported successfully or the solution failed.

Below is the code snippet which can be used to Import the solution asynchronously.

ExecuteAsyncRequest request = new ExecuteAsyncRequest
{
Request = new ImportSolutionRequest
{
//set the compressed solutions file path to import
CustomizationFile = File.ReadAllBytes(solutionFilePath),
//set whether any processes (workflows) included in the solution should be activated after they are imported
PublishWorkflows = true,
//set whether any unmanaged customizations that have been applied over existing managed solution components should be overwritten
OverwriteUnmanagedCustomizations = true,

}
};

ExecuteAsyncResponse response = (ExecuteAsyncResponse)_service.Execute(request);
In the response of this request you will get a async job id as highlighted below:

img1

You can simply navigate to the System Jobs area and you will find the job submitted in CRM and you can see the status of this job whether the import succeeded or failed.

img2If you want to programatically check the process of this solution then you can retrieve async job from the id and check the status of that job whether the solution has succeeded or failed.

Conclusion:

The main advantage of an asynchronous solution import is, the users who are interacting with the system will not face SQL timeout issues when the solution is being imported asynchronously.

Thanks.

Curtsy: www.inogic.com  

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