Microsoft Dynamics CRM - Solutions
Solutions provide a framework for packaging, installing, and uninstalling components to match your business functionalities. Solutions allow the customizers and developers to author, package, and maintain units of software that extend CRM. Any customizations, extensions, or configurations performed in CRM are packaged, managed, and distributed using solutions. The solutions can be exported as a zip file from the source organization, which can then be imported in the target organization.
For understanding this, consider the following example scenarios −
You, as a developer or customizer, have extended or customized CRM in the development environment. Now you want to package your changes and move it to the next environment. For this, you can create individual solutions and publish them in higher environments.
You, as a third party CRM provider, have created a CRM module, which allows managing data in Microsoft Dynamics CRM entities using external Web service APIs. Now, you want to sell this module to other clients. Using solutions, you can package this module and distribute them to other clients who will be able to install this solution and use the functionalities provided by your module.
Types of Solutions
Default System Solution
The system solution contains the out-of-the-box solution components defined within Microsoft Dynamics CRM without any customizations. Many of the components in the system solution are customizable and can be used in managed solutions or unmanaged customizations.
Throughout this tutorial, we did not create any solution and were customizing the default system solution. If you recall, we went to Settings → Customizations → Customize the System. This option directly customizes the default solution.
A managed solution is a solution that is completed and intended to be distributed and installed. Managed solutions can be installed on the top of the system solution or other managed solutions.
Important Points −
If you export a managed solution from one organization and import it to another, you can’t edit the solution in the new organization.
A managed solution does not directly reference the system solution.
Uninstalling a managed solution uninstalls all the customizations associated with the solution.
By default, a managed solution can’t be customized in the target organization. However, using the concept of managed properties you can define whether a solution component will be customizable and if yes, then which specific parts of the component will be customizable once the solution gets exported as a managed solution.
An unmanaged solution is a solution that is still under development and not intended to be distributed. An unmanaged solution contains all the unmanaged customizations of CRM components including any added, modified, removed, or deleted components. By default, any new solution is an unmanaged solution. However, you can export an unmanaged solution as a managed or unmanaged solution.
Important Points −
If you export an unmanaged solution from one organization and import it to another, you can edit the solution in the new organization.
An unmanaged solution directly references the system solution. Hence, the changes made to one unmanaged solution will be applied to all the unmanaged solutions that references the same components, including the system solution.
If you delete a solution component from an unmanaged solution, the component gets deleted permanently from the system and will no longer be available. In case you just want to remove the component from specific unmanaged solution, use remove instead of delete.
Uninstalling an unmanaged solution does not remove the associated customizations. It just deletes the solution from the system, but the changes you made will still be there.
A solution can be used to package the following components which can be customized using default, unmanaged, or managed solutions.
|Global Option Sets|
|User Interface||Application Ribbon|
|Field Level Security Profiles|
Creating a Solution
Step 1 − Navigate to Settings → Solutions. Click New.
Step 2 − In the window that follows, enter the following details and click Save and Close.
Display Name − Sample Solution (This can be any name that you want).
Name − Will be automatically set based on the Display Name. However, you can change this.
Publisher − Default Publisher. Solution publisher provides a common customization prefix and option value prefix. Defining a solution publisher controls how your managed solutions can be updated once distributed. However, for this example and for most of the general cases, you can set this as Default Publisher.
Version − Specify a version with the following format: major.minor.build.revision. For example: 188.8.131.52.
By default, every solution is added as an unmanaged solution. Once a solution is added, you can add solution components by creating them in the context of this solution or by adding the existing components from other solutions. For example, you can create new entities, forms, etc. in the context of this new solution.
Exporting a Solution
Once you have all the changes in place that you want to package as a managed or unmanaged solution, you can export your solution as follows.
Step 1 − Open the source organization and navigate to Settings → Solutions. Select the solution that you want to export and click the Export button.
Step 2 − In the Publish Customizations window, click Publish All Customizations and then click Next.
Step 3 − In the window that follows, you can optionally select any system setting such as auto-numbering, calendar settings, etc. to be exported with the solution. For now, you can avoid selecting any option and click Next.
Step 4 − In the Package Type window, you can select whether you want to export the package as a managed or unmanaged solution. For this example, let us export it as unmanaged. Once done, click Next.
Step 5 − In the next window, you can see the source version of CRM that you are using and can select the target version. Click Export.
Step 6 − Once you click Export, the solution will be exported as a zip file. Save this zip file at a desired location on your system.
Importing a Solution
Now, we will import the solution zip file that we exported in the previous section to a new target organization.
Step 1 − Open the target organization and navigate to Settings → Solutions. Click Import.
Step 2 − Browse the zip file that you downloaded from the export step and click Next.
Step 3 − From the next window, you can view the solution package details if needed. Clicking Import will start the solution import process.
Step 4 − Once the import process completes, it will show the status of success or failure. If the process succeeds, click Publish All Customizations. In case the solution importing fails, it will give you a detailed error log on which step of the import process failed.
Step 5 − We’re done. The solution will be successfully imported to the target organization. Click Close.
Since you can have multiple developers working on customizing and extending CRM, you will have multiple managed and unmanaged solutions. Exporting and importing these solutions can sometimes result in conflict scenarios. For example, suppose ‘Solution A’ contains a field on a form while ‘Solution B’ has removed the field and ‘Solution C’ has renamed the field. In this scenario, what would be the final change? In such conflicting scenarios, CRM uses two approaches.
Merge − This approach is used for user interface components such as command bar, ribbons and site maps. As per this approach, the solution components are re-calculated from the bottom and the organization’s unmanaged customizations are the last to apply.
Top Wins − This approach is used for all other conflict scenarios except the user interface components. As per this approach, the last change (either managed or unmanaged) takes the priority and gets applied.
In this chapter, we introduced the concept of solutions and different types of solution and their components. We then learnt how to create, export, and import a solution. Finally, we studied about the two conflict resolution strategies, which takes place when we have multiple managed and unmanaged solution affecting the same solution components.