I'm struggling to find dependencies for CRM entity attribute from C# code, but I cannot find the right way.
The code like this:
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 negative result. I suppose it's incorrect to use attribute MetadataId
as ObjectId
. But it seems it is impossible to find out ObjectId
for attribute.
Does anybody faced with similar task before? How did you solve it?