我正在努力从C#代码中找到CRM实体属性的依赖关系,但是我找不到正确的方法。
像这样的代码:
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);
给出否定的结果。我认为将attributeMetadataId
用作不正确ObjectId
。但是似乎无法找到ObjectId
属性。
以前有人遇到过类似的任务吗?您是如何解决的?
您可以使用AttributeMetadata.AttributeType属性,该属性指示属性的类型(字符串,查找,选择列表,布尔值等),但是您需要componenttype值,它是解决方案组件的类型(Entity,Attribute,Relationship,Option Set等)。在您的情况下,其2.组件类型及其代码的完整表可以在此处找到。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句