Search This Blog

Thursday, September 29, 2022

Clone Solution vs Clone Patch in Dynamics 365 – Release management capabilities in Dynamics 365

Moving the developed solutions from dev environment to other environments is as critical (or more critical) as developing solutions without defects. Often dev team focuses more on building solutions in the dev without bugs and tend to make mistakes in the deployment (mostly depends on the pressure during the deployment, time available for pre-deployment activities and also smaller release window for deployment if CRM is already mission critical).

 Microsoft CRM has few features to help you with the release management and this post would be helpful if you are unaware of the features or not making the right usage of the features – Clone Patch and Clone Solution.

A usual release management process in an agile [or similar] delivery mode would be:

 Dev team develops the deliverables in Dev environment

  1. To release defect fixes / new changes every day or every week as patches to QA environment
  2. Move the stable solution [with all the patches] to production in a monthly / bi weekly production release cycle.

CRM solution management features Clone Solution & Clone Patch would help the team in enabling continuous delivery [CI/CD] of the software packages to production.

Multiple Environments

Consider there are three environments [ Dev, UAT and Prod]

Dev:  http://<server>/devdemo/main.aspx

UAT:  http://<server>/uatdemo/main.aspx

Prod: http://<server>/proddemo/main.aspx

 Base Solution

  1. Create a solution in CRM Dev with all the changes [ Entities/Web resources/Plugins etc.]. For the demo, I have added only the Account entity in the base solution

  1. Export the solution as a managed solution from dev and import to the UAT environment

 Dev:

UAT:

Patch (1.0.1.0) on Base Solution – 1st set of changes from UAT

Imagine there is an issue raised in UAT and you need to add the contact entity also to the managed solution, all we need to do is to clone a patch and add Contact entity to the solution.

 Let’s clone the patch for exporting only the new change(s)

 

Now open the patch solution and add the additional components to be moved to UAT

 

 

Once the components are added, export the patch solution in ‘Managed’ mode

 Import the ‘Managed’ patch solution package in to UAT environment

Once a Patch is created, base solution becomes parent solution and components cannot be added or removed from the base solution now. This lock would be released when either the patches are deleted or the solution itself is cloned [we are coming to the ‘Solution Clone’ topic next]

Patch (1.0.2.0) on Base Solution – 2nd Set of changes from UAT

Now imagine if UAT team raises another issue related to Lead entity and we need to release the Lead entity changes to UAT.

Let’s create a patch update of the base solution package by using the Clone Patch feature again and add the Lead entity in the new patch [v1.0.2.0]

 Add the Lead entity in the new patch created and export the Patch as a managed solution and import in to UAT. After the Patch is deployed in UAT, there will be 3 solutions [ Base packages and 2 Patch solutions]

 Production Release – Finalize the production release package

Now we got the UAT signoff for the sprint and it’s time for moving the release package with all changes to production. Let’s ‘Clone the Solution’ and make the production package ready with all the patches [remove any patch if not required from the source before cloning the solution if need to remove any changes]

 When solution is cloned, Minor version would be incremented by 1 by default and build and revision would be non-editable

Once the solution is cloned, all the patches are merged in to the new Upgrade solution [ Minor version updated]

  Let’s move the solution to UAT

 

 Apply Solution Upgrade – On demand Solution Upgrade if Patches exist in the environment

When an upgraded solution is imported in to the environment which has the patches already deployed [ in our case UAT has the patches and Prod doesn’t have patches] applying the solution upgrade is a manual activity and can be on demand.

Before Solution Upgrade [ Solution packages are not merged until the Solution Upgrade is applied]

  • After Solution Upgrade [Solutions would be merged once the Solution Upgrade is applied]

Let’s move the solution to Prod

 

Solution Upgrade is applied by default since there was no patch deployed already in the environment

Hope this helps you to understand the different usages of Solution Patch and Solution Clone.

Below image shows the CRM release management strategy [using Clone Solution & Clone Patch] explained in this post in a nutshell:

 Please let us know if you have a different view for managing the Solutions/Patches better.

 References:

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/create-patches-simplify-solution-updates

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/create-install-update-managed-solution

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/work-solutions


Using ‘Clone a Patch’ & ‘Clone Solution’ in Dynamics 365 Solutions

Doing incremental deployments from Sandbox to Production is a part of every other D365 implementation.

And when do this, typically, you just create a new solution for every single time you move things over. This creates a lot of mess and leaves your Solutions in unorganized dump!

Let’s see how we can stay organized by using Clone a Patch and Clone Solution to keep things synced and clean

Clone a Patch

Clone a Patch should be used when you don’t want parent dependencies in the solution all over again unless you want to change them. So, always use this when you want to add newer things to a previously existing solution.

  1. I have created MainSolution_1 as my main solution, the first time I started my customization. I added only 1 field, called Target Sale for demonstration purpose.
    mainsolution
  2. Now, let’s say I deployed it over, the next time I want to add some more functionality to the existing solution I deployed, I should not create another solution.
  3. Rather, I’ll use Clone a Patch as shown below.
    cloneapatch
  4. In Clone a Patch, I’ll keep the Display name same and the version number is configurable up to the last 2 sub-versions.
    clonepatchproperties
  5. So this is how my Patched solution will look.
    preparedclone
  6. In this solution, I’ll add another field called as Min Target To Achieve and deploy it over to Production, maybe.
    patchcontents

Clone Solution

Clone a Solution is used when you have a main solution and several patches. Clone a Solution will roll up everything into a new “parent” solution and remove every other solution of which you cloned including the source solution.

  1. I’m select MainSolution_1, the first main solution I had created with the field Target Sale field. And then I chose to Clone Solution.
    clonesolution
  2. Similar to Clone a Patch, I have now the version control over the first 2 version numbers and since it is the first Clone, the final numbers are 0.0. I named it MainSolution_1_Cloned.
    clonesolutionproperties
  3. It takes a few moments to Clone everything.
    inprogress
  4. Now, I have cloned the solution and the resultant solution has all the components from the Main Solution as well as from the Patch solution summed into 1 final solution.
    cloned
  5. Also, notice that all the other solutions including the MainSolution_1 from which I cloned this solution is deleted.
    cleanedsolutionsarea

Advertisements
REPORT THIS AD

Thereby, you have a clean Solutions area with all sorted work.

Hope this helps.  


DYNAMICS 365 HTML WEB RESOURCE EXAMPLE

 In Dynamics 365, we can create and use HTML pages through web resources. Let’s look at how to do this.

In a simple example, let’s display a Hello World from a website on the Account record.

First, in Dynamics 365, go to Settings->Customizations and select either Customize the System or choose an existing Solution (or create a new one) to get to the Account form:

We will select Customize the System, and open the Account main form:

Let’s add a new tab to put the resource in:

Select the tab, and then Insert->Web Resource:

This opens below:

Click on the Web Resource lookup and go to Look Up More Records:

Click New:

Enter a name, display name, select Webpage as the type and click on Text Editor:

This opens the page, where we can enter rich text or click on Source to change the HTML source:

Let’s enter Hello World!:

This generates the following code:

Click OK, then Save and Publish:

Close the window, and you will now see our Web Resource ready to use. Select it and click Add:

We can now see the name and label of the web resource. Click OK:

Our form now looks like below. Click Save and Publish:

The web resource will now be displayed on the form: