In my last month’s blog, I highlighted new and improved features of Microsoft Dynamics CRM Solution Framework. I discussed about:

  • Solution Components
  • Clone a Patch
  • Clone a Solution

In this month’s blog, I will discuss about “Applying a Solution upgrade”.

dynamics crm solution framework - applying solution upgrade

Figure 1: Apply Solution Upgrade feature

 

Apply Solution Upgrade

This feature is primarily dedicated to the large ISV community of Microsoft Dynamics CRM.

Problem statement

In the past, deleting a solution asset from a managed solution has always been a difficult and frustrating task. A number of steps were to be performed for deleting a solution asset.

A technique commonly referred to as holding solution process was used to delete a solution component. This approach required an in depth understanding of solution system and manipulation of solution.xml file. However, it also means putting the system at risk of being not supported by Microsoft, as manipulating the XML file is considered a violation of SDK contract.

For more details on Holding Solution Process, please refer to the following blogs

Deleting things from a deployed CRM 2011 managed solution package by keydet

CRM 2011: Deleting Attributes, Entities, Relationships or OptionSets from Managed Solutions by Gonzalo Ruiz

New improved approach

As you may realise, existing process requires a number of distinct steps to delete a component from the solution and may be more if there are oversights (which is highly likely considering the complexity of existing procedure).

In Microsoft Dynamics CRM 2016, this procedure has been incorporated into UX and SDK and is more of a two- step process from a user’s perspective.

Let’s consider following scenario.

Scenario: I have a solution with two custom entities (“Custom 1” and “Custom 2”). I want to delete “Custom 2” entity and add a new “Custom 3” entity.

managed solution

Figure 2: Managed Solution with two Custom entities (Custom 1 and Custom 2)

 

Solution steps

  1. Start with an existing solution Solution A (1.0.0.0) in the source environment (usually development environment).
step 1

Figure 3: Solution A (1.0.0.0) in development environment

  1. Select Solution A (1.0.0.0) and click Clone Solution. Change the build number as required. E.g. Solution A (2.0.0.0) in this case.
clone to solution

Figure 4: Create Solution A (2.0.0.0)

  1. Modify Solution A (2.0.0.0) as per requirement. In this case, delete “Custom 2” entity and create new “Custom 3” entity.

 

modify a solution

Figure 5: Custom 2 entity deleted in Solution A from source environment

  1. Create new “Custom 3” entity.
create custom entity

Figure 6: Custom 3 entity created

  1. Save and Publish All Customizations.
  2. Export Solution A (2.0.0.0) from source environment as managed solution and import into the target environment.
Import managed solution

Figure 7: Import managed Solution A (2.0.0.0) into target environment.

  1. When importing this solution into target environment, you can choose to select Stage for upgrade (Import as a holding solution) as shown below in Figure 8. This new option Stage for Upgrade is optional, if no patches exist. But required, if patches exist.
stage for upgrade

Figure 8: Stage for upgrade

  1. Once the import process is finished, click Apply Solution Upgrade as shown in Figure 9 below. Apply Solution Upgrade step internally performs following actions in CRM
  • Deletes any patches
  • Deletes the original solution (old solution)
  • Updates upgrade solution to the new name
applying solution upgrade 2

Figure 9: Apply Solution upgrade

  1. Once the process is complete, open solution A (2.0.0.0) in the target environment to verify the changes.
custom entity 2 deleted

Figure 10: Custom 2 entity deleted successfully.

 

Result

This new feature of Apply Solution Upgrade has extended Microsoft Dynamics CRM’s solution capabilities to the next level. It has successfully recognised following key points

  • Removal of Solution assets from a managed solution using Solution upgrades
  • Multiple developers can easily work on patches
  • All patches can be rolled into a single solution