Managing components in a managed solution in Dynamics 365 CRM can be challenging due to the limitations imposed. By following the right steps, it is possible to update or delete entities, assemblies, or processes. Using Dynamics 365 CRM examples, we will explore how you can perform these operations.
What is a Managed Solution?
Before diving into the steps, it’s important to understand what a managed solution is. In Dynamics 365, a managed solution is a completed solution that can be installed, updated, or deleted from another environment. Unlike unmanaged solutions, managed solutions are locked, meaning that their components cannot be edited directly in the target environment.
Updating an Entity, Assembly, or Process
Example Scenario: Updating a Custom Entity
Let’s say you have a custom entity called “Project Tasks” in your managed solution, and you need to add a new field called “Task Status”.
Step-by-Step Process:
- Open Your Unmanaged Solution in the Development Environment:
- Go to your development environment, where the original unmanaged solution exists.
- Navigate to Settings > Solutions, and select your unmanaged solution containing the “Project Tasks” entity.
2. Update the Entity:
- In the solution, open the “Project Tasks” entity.
- Add the new field “Task Status” and make any necessary customizations.
- Save and publish all customizations.
3. Increase the Version Number:
- After making the changes, go back to the solution properties.
- Update the version number of your solution (e.g., from 1.0.0.0 to 1.1.0.0). This is crucial for managing upgrades in the target environment.
4. Export the Solution as Managed:
- Once the changes are done, export the solution as a managed solution.
- Download the managed solution file (.zip).
5. Import the Updated Managed Solution into the Target Environment:
- Now, go to your target environment (e.g., production) and navigate to Settings > Solutions.
- Select Import and upload the new version of your managed solution.
- Dynamics 365 will automatically upgrade the existing components with the updated version. The new field “Task Status” will now be available in the Project Tasks entity.
This method ensures that the updates are applied without manually altering the managed solution in the target environment.
Deleting an Entity, Assembly, or Process
Example Scenario: Deleting an Unused Workflow Process
Suppose you have a workflow process called “Task Reminder Process” that is no longer needed in your managed solution.
Step-by-Step Process:
- Remove the Component from the Unmanaged Solution:
- In your development environment, go to Settings > Solutions and open your unmanaged solution.
- Find the “Task Reminder Process” workflow and delete it from the solution.
- Increase the Version Number:
- Just like in the update scenario, update the version number of your solution (e.g., from 1.1.0.0 to 1.2.0.0).
- Save and publish all customizations.
- Export the Solution as Managed:
- Export the updated solution as a managed solution.
- Import the Updated Managed Solution into the Target Environment:
- Go to the target environment, navigate to Settings > Solutions, and import the updated managed solution.
- Dynamics 365 will remove the “Task Reminder Process” workflow from the managed solution during the import process. This is known as a solution upgrade.
Important Considerations:
- Dependencies: When attempting to delete components, you may encounter dependency issues. For instance, if the workflow process you want to delete is being referenced by another component, you’ll need to address these dependencies first.
- Example: If the “Task Reminder Process” workflow is linked to a specific field in another entity, you’ll need to either remove that reference or update the related component before deleting the workflow.
- Irreversible Deletion: Deleting components from a managed solution is irreversible. Ensure that you have backed up your solution and are certain that the component is no longer needed.
Using Patches for Minor Updates
Patches can be used instead of full solution upgrades for minor updates. Patches contain only the changes you wish to make and can be applied to existing managed solutions.
Example: Adding a New Field to the Entity Using a Patch
- In your development environment, create a patch for the managed solution.
- Add the new field “Task Status” to the patch.
- Export the patch as a managed solution.
- Import the patch into the target environment to apply the update.
In Dynamics 365 CRM, updating or deleting components requires careful planning and execution. In a managed environment, you can effectively manage your components by following the correct steps – whether through full solution upgrades, patches, or dependency removal.
These examples illustrate common scenarios, but each environment may have its unique complexities. Always make sure to test your solution in a sandbox environment before applying changes to production.