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 |
|
d347f96b-a137-42e1-a9bf-fac6d6133330 |
JimDaly |
nabuthuk |
pehecke |
|
Drafting |
|
[!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]
[!includecc-how-to-run-samples]
The RetrieveDependentComponentsRequest
, RetrieveDependenciesForDeleteRequest
messages are intended to be used in a scenario where it contains data to detect solution dependencies.
In order to simulate the scenario described in What this sample does, the sample will do the following:
- Checks for the current version of the org.
- The
Publisher
method creates the sample publisher that willown
the two solutions. - The
Solution
method creates the primary solution. - The
OptionSetMetadata
creates the global option set and associates it to the solution. - The
ExportSolutionRequest
exports the solution as managed so that we can later import it. - The
DeleteOptionSetRequest
deletes the option set previously created, so it can be imported under the managed solution. - The
ImportSolutionRequest
re-imports the solution as managed.
- The
QueryByAttribute
queries all solution components for a solution. - 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.
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]