Skip to content

Latest commit

 

History

History
66 lines (47 loc) · 2.94 KB

sample-detect-solution-dependencies.md

File metadata and controls

66 lines (47 loc) · 2.94 KB
title description keywords ms.date ms.custom ms.topic applies_to ms.assetid author ms.author ms.reviewer ms.suite ms.tgt_pltfrm helpviewer_keywords topic-status search.audienceType
Sample: Detect solution dependencies | MicrosoftDocs
Learn how to detect dependencies before deleting a solution component with this code sample for Dynamics 365 Customer Engagement (on-premises).
04/02/2020
sample
Dynamics 365 Customer Engagement (on-premises)
d347f96b-a137-42e1-a9bf-fac6d6133330
JimDaly
nabuthuk
pehecke
detecting solution dependencies sample
sample for detecting solution dependencies
solution entities samples, detecting solution dependencies sample
Drafting
developer

Sample: Detect solution dependencies

[!INCLUDE applies-to-on-premises] Sample: Detect solution dependencies.

This sample shows how to detect dependencies before you delete a solution component. You can download the sample from here.

[!includecc-sample-note]

How to run this sample

[!includecc-how-to-run-samples]

What this sample does

The RetrieveDependentComponentsRequest, RetrieveDependenciesForDeleteRequest messages are intended to be used in a scenario where it contains data to detect solution dependencies.

How this sample works

In order to simulate the scenario described in What this sample does, the sample will do the following:

Setup

  1. Checks for the current version of the org.
  2. The Publisher method creates the sample publisher that will own the two solutions.
  3. The Solution method creates the primary solution.
  4. The OptionSetMetadata creates the global option set and associates it to the solution.
  5. The ExportSolutionRequest exports the solution as managed so that we can later import it.
  6. The DeleteOptionSetRequest deletes the option set previously created, so it can be imported under the managed solution.
  7. The ImportSolutionRequest re-imports the solution as managed.

Demonstrate

  1. The QueryByAttribute queries all solution components for a solution.
  2. The RetrieveDependentComponentsRequest retrieves all the dependencies for the component. If there are no dependencies we can ignore this component. If there are dependencies upon this solution component, and the solution itself is managed, then you will be unable to delete the solution.

Clean up

Display an option to delete the solutions created in Setup. The deletion is optional in case you want to examine the entities and data created by the sample. You can manually delete the records to achieve the same result.

[!INCLUDEfooter-include]