Solution Patching in Microsoft Dynamics CRM 2016

By | January 14, 2016

Introduction

In our earlier blog we looked into the enhancements made to the way solutions can be created in Microsoft Dynamics CRM 2016. Now moving forward we will look at a common scenario of sending out Patches for your solution. Often it happens that you may need to update a few components of your managed solution and ideally would like to have a way to only have those shipped and then have a way to compile all of these patches in the next release of the solution. This helps with better versioning control and management of the solution assets.

Patches

Taking it forward from our previous article, here is what our solution looked like.

Solution patching

Keep your eye on the Version number of the solution as this is one of the critical thing which will come to notice as we move ahead.

Now suppose due to some requirement changes I have to increase the maximum length for “First Name” field of Contact from 155 to 175.

Since this field was a part of the earlier solution that we had and this is the only change we need to make to that solution, we will go ahead and create a patch for the original solution

Use the “Clone a Patch” button added to the solutions views

Solution patching in crm

Notice the other buttons as well “Clone Solution” and “Apply Solution Upgrade”, this completes the entire solution management architechture.

clone to patch

It is a good practice to increment the version number for a proper version management of the solution. Since this is a patch it only allows you to modify the last 2 digits in the version.

This creates the following new solution.

Solution patching in crm 2016

Add only the Contact “First Name” field to the solution and update the length as shown below.

Solution patching in dynamics crm

When you import this patch on the client environment this solution will be applied on top of the base solution and only the “firstname” field will be updated.

Solution patching

You can create multiple patches for a solution. To create another patch you would select the original solution and click “Clone a Patch”.

Solution patching

The original solution can no longer be modified.

Solution base solution

In the Target system, you can delete the managed solution of a patch without affecting the base solution installed there.

The patches don’t have a dependency on each other, so in the target system I deleted the first patch that was imported and then imported the second patch and it works just fine. So that’s huge plus, since one of the problems with earlier solution management architecture was the dependencies that would be created between managed solutions. So here there is no dependency of the patches amongst them. But of course they do need the base solution present since they are patch for the base solution.

Solution patching in ms crm

Uninstalling the base solution on the target also automatically uninstalls all the patches that were installed for the base solution.

When you want to plan your next version of the solution, you usually want to rollup all of the patches that were released for the base solution into the new solution, before you can add new changes in there. This can be done using the “Clone Solution” button.

Solution patching in crm 2016

Now this time, you are only allowed to change the major and minor parts of the version.

Once the operation completes, you will find the patches deleted and the base solution version updated.

Solution patching

This solution is now available for editing as well.

When the Upgrade solution is imported on the target system, it auto detects this to be an upgrade to an existing installed package and notifies you of the same.

Solution information

On the next step of the import wizard, you get the option to choose if you want this imported as “Holding Solution”. This option will show up and checked by default if the target organization has base solution and patches for base solution installed. You can learn more about the “Holding Solution” concept here

upgrade solution

When the solution import completes, you see a new option “Apply Solution Upgrade” since you chose to import this as a holding solution.

Solution patching - importing solution

If you do not choose to apply the solution upgrade, you will see three solutions in the target system.

Solution patching

Now choose the original Base solution on the target system and click on the “Apply Solution Upgrade” button to keep a single solution for the package instead of the three that appear now

Solution patching

If there were no patches installed in the target system and the “Stage for Upgrade” option is unchecked, you have the option to check it if you want. If you leave it unchecked it simply updates the solution and you do not need to “Apply Solution Upgrade”.

Note : We have explained all the above scenarios using Managed Solution. When we tried with Unmanaged solution we got error “Action could not be taken for few records before of status reason transition restrictions” while importing Unmanaged Solution patch. But we were able to successfully import the cloned Unmanaged Solution for the same.

Conclusion

Though I have only explored this using basic customizations to entities, the whole solution management framework from creating a solution to patching to moving it to the next release and similarly “upgrading solution” on the target system appears that, it would reduce if not end a lot of “solution import” woes of the ISV community.

Free 70% of storage space in CRM with Attachment Management Apps!

Attach2Dynamics – Store and manage documents/attachments in cloud storage of your choice – SharePoint, Dropbox or Azure Blob Storage from within Dynamics 365 CRM.
SharePoint Security Sync – Robust and secure solution to integrate Dynamics 365 CRM and SharePoint Security Sync thereby ensuring secure access to confidential documents stored in SharePoint.

0 thoughts on “Solution Patching in Microsoft Dynamics CRM 2016

  1. gk078113

    1) The holding a solution upgrade concept only applies to managed solutions? I imported an unmanaged solution upgrade and it did not display the Import Options. 2) I tried importing an unmanaged patch and it gave me errors. Microsoft support is looking into. Seems like a bug since they were getting the same error message.

  2. Foo

    When attempting to import Managed Solution patch was receiving the “Action could not be taken for few records before of status reason transition restrictions” error. Patch Solution file contained an update to 2 realtime workflows that used custom workflow activities, found that by deactivating the workflows in the target & unticking the enable sdk steps option was able to import without error and then manually activate the 2 processes.

    1. inogic

      Hi,

      The specified error is not specific to solution patching functionality but is related to the Status Reason Transitions functionality introduced with Microsoft Dynamics CRM 2013 SP1. When attempting to change the Status and Status Reason of a record to a Status and Status Reason that is not allowed by the Status Reason Transitions configuration for the entity the error is thrown.

      Kindly refer to this blog for more details on Status Reason Transitions functionality.

      Hope this helps.

  3. clement

    Hello Inogic,

    Great article, i’ve tried as you said to import a Patch of an unmanaged solution and i got the error you mention.
    You then say that you have been able to import the unmanaged solution : “But we were able to successfully import the cloned Unmanaged Solution for the same.”
    Do you mean by this that you had to Clone the solution to merge the Patches and then Export and Import to the target environment ? If yes, there is no use for the patch for the moment then right ?

    Clément

    1. inogic

      Hi Clement

      Yes, as mentioned in our blog we were not able to perform patching functionality with unmanaged solution, but we were able to successfully import cloned unmanaged solution. So this functionality is full-fledged working with managed and partially working with unmanaged solution.

      Thanks,
      Sam