Patches & How to Create Patches in CRM
CRM Patches is the new advance feature of MS CRM 2016, this is a new grainy approach, when building solutions and deploying patches. This feature can be incredibly useful when you want to deploy only a small part of your customizations.
A few things are important for patches-
- A patch can be installed only if you also have the parent solution.
- Each patch can have only a single parent solution.
- The parent solution cannot be a patch.
A patch will support the parent solution’s operational functions, such as additive update. It will also carry the same minor and major numbers as the parent solution. However, it may have a different display name as well as a higher release and build number.
Versioning of a patch is very similar to that of the solution. The format here is major. minor. build. release. Also, you cannot make any change in the existing minor or major version during the formation of the patch. If there is an existing patch, future patches will have a higher version number.
Keep in mind that a patch cannot remove components present in a solution. For that, you will have to carry out an upgrade. In software, you will also need at least the Dynamics 365 organizations version 8.0 or later. To import or export a patch, we can use Web APIs or Organization Service, Package Deployer or the web application tool.
How to create Patches-
For this operation, we take a scenario where we can use patches, we have a requirement to import some of the customization in production environment, after some time, If the requirement has been changed and we need some more customization to that organization then, we need this new changes in the production environment. For such things we don’t need to import full solution to that environment. Here we can create patches.
Here is an example – To do this, you need to create a solution:-
Here you need to follow few steps-
1). First step is to create a solution with Account Entity, For creating a solution follow the below path-
Setting?solution?click on new button icon in left hand side of the window, when you click this button, a new window is opened here, you have to provide your solution name, version number, publisher name after this click on save and close button.
Refer the below image-
When your solution creation is completed, it will be displayed in your main solution list.
Refer the below image-
Double click on solution “TestSolution11”, a new window will open, here you have to add your entity in the solution,
Refer the below image-
If you want you can add a new component or existing, here I am going to add existing account Entity, for this, you need to click on Add Existing button,
Then one new window will be displayed.
Refer the below image-
Here, I am selecting Account Entity then click on OK button, after this a new window will popup.
Here you have to select the include entity metadata, and all assets checkbox, then click on finish button.
Refer the below image for this-
After this another popup is displayed here, You have to add Missing requirement component. Either Yes or No, then you need to click ok OK button.
After these steps your account entity is added to your solution- see the below image-
After all this steps you need to save and publish the customization.
2). In the second step, you need to import this solution to your target environment as a Managed soln.
3). After the requirement change, we need to add one contact lookup field in Account Entity main form.
4). To do this, we don’t need to create new solution we are going to create patches for this, which include our new changes.
Follow the below steps for creating patches-
1). Select your solution form the solution list and click on “Clone a Patch” button In a solution list
After this one popup is display here you need to click OK button.
Refer the below image-
After this your patch will appear in the solution list-
Refer the below image-
2). After this, go to customization, select Account entity, create one new field Contact which is Lookup type and add this field in your account entity form after this, Save and publish the customization.
See the below image-
3). After this step, open your patch solution and add your account entity in this way select add existing button from the ribbon when you click on add existing one popup is display,
Here you have to choose account entity and click on OK button, A new window will pop here, you need to select your account main form
Refer the below image-
After this, a new popup is displayed, here you will see we have added a new field contact in account entity and the relationship is created automatically when we create field lookup type, after this click on Ok button.
Refer the below image-
4). After all this steps your account entity is added to your solution ,you need to save and publish the customization- Refer the below image-
5). After this, you need to export this patch in your system and again import to your target environment-
After the successful import it will appear in your solution list, after this when you create a new account your new customization will be available in the account form-
Refer the below image-
Author Bio: In this tutorial, Dynamics CRM developers have explained us about patches and how to create patches in CRM. If you face any difficulties in the coding part, please leave your comments below, we would be happy to help.
Comments
-
Hi, I had created several patches in my Dev environment which have been exported as managed and imported to Production. i have now cloned the solution in Dev so all the patches have combined. whats the correct process for exporting this new solution as managed and importing to Production?
*This post is locked for comments