Find Dependencies for a Dynamics CRM Entity Attribute

I am trying to find dependencies for a CRM entity attribute on C # code, but I cannot find the correct path.

The code is as follows:

var attributeRequest = new RetrieveAttributeRequest
{
    EntityLogicalName = "invoice",
    LogicalName = "billto_city"
};

var attributeResponse = (RetrieveAttributeResponse)proxy.Execute(attributeRequest);

var dependenciesRequest = new RetrieveDependenciesForDeleteRequest
{
    ObjectId = (Guid)attributeResponse.AttributeMetadata.MetadataId,
    ComponentType = (int)attributeResponse.AttributeMetadata.AttributeType
};

var dependenciesResponse = (RetrieveDependenciesForDeleteResponse)proxy.Execute(dependenciesRequest);

Gives a negative result. I believe it is wrong to use an attribute MetadataIdlike ObjectId. But, apparently, it is impossible to recognize the attribute ObjectIdfor the attribute.

Has anyone encountered a similar problem before? How did you solve it?

+4
source share
1 answer

AttributeMetadata.AttributeType, (, lookup, picklist, boolean ..), componenttype, (Entity, Attribute, Relationship, Option Set ..).). 2. .

+1

Source: https://habr.com/ru/post/1532853/


All Articles