Skip to main content

Notifications

Dynamics 365 Community / Forums / Sales forum / How can I query a fiel...
Sales forum
Suggested answer

How can I query a field's dependencies by name?

Posted on by 15

To avoid a lot of unnecessary details, our system is made up of several unmanaged solutions. When migrating these solutions, we frequently run into conflicts with certain fields, such as if a field OptionSet was changed to use a Global OptionSet, etc. Because we're using unmanaged solutions, most import tools/scripts don't deal with these conflicts automatically, so we end up having to manually remove the field's dependencies then deleting the field from the target environment in order to load our solutions.

As a result, we're looking for a way to query a field's dependencies in order to automate the process of removing these dependencies.

I've gotten as far as querying the Entity Metadata, which does contain information about our entities and their fields. Unfortunately, I can't quite figure out how to link that to the ObjectId field on the RetrieveDependenciesForDeleteRequest, which appears to be what we're looking for. 

I've tried feeding the MetadataId from a field into a RetrieveDependenciesForDeleteRequest, but this throws an exception so it's clearly not the right GUID. 

Any suggestions?

Categories:
  • Suggested answer
    Steve Zhao2 Profile Picture
    Steve Zhao2 on at
    RE: How can I query a field's dependencies by name?

    Hi FredJ,

    I checked the SDK reference, and it says that the objectId should be the SolutionComponentId in the SolutionComponent entity.

    RetrieveDependenciesForDeleteRequest.ObjectId Property (Microsoft.Crm.Sdk.Messages) | Microsoft Learn

    Here is a similar thread:
    How do you retrieve the appropriate dependency using RetrieveDependenciesForDeleteRequest - Microsoft Dynamics CRM Forum Community Forum

    And if you query a field, its component type should be 2. Something like this:

    xxx.api.crmx.dynamics.com/.../RetrieveDependenciesForDelete(ObjectId=c28ee4fd-490c-419c-86f5-4e11765f936c,ComponentType=2)

Helpful resources

Quick Links

Dynamics 365 Community Update

Welcome to the inaugural Community Platform Update. As part of our commitment to…

Dynamics 365 Community Newsletter - August 2024

Catch up on the latest D365 Community news

Community Spotlight of the Month

Kudos to Mohana Yadav!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,107 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 227,954 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans