有没有办法(插件到XrmToolBox,代码片段)来获得指向我的实体的查找属性列表?我需要完全相同的列表作为在FetchXML生成器插件,链接-实体关系1:M (见图片),并能够复制这个列表。(我的实体是机会)

谢谢你的建议。
发布于 2020-02-07 09:52:23
如果你只是想要复制和粘贴列表,你可以使用CRM的WebAPI在浏览器中获得
/api/data/v9.0/RelationshipDefinitions/Microsoft.Dynamics.CRM.OneToManyRelationshipMetadata?$select=SchemaName&$filter=ReferencedEntity eq 'account'
此查询执行以下操作:
account entity为目标的属性
您只需在浏览器中打开您的CRM组织,并将上述行粘贴到您的CRM地址之后
例如:
发布于 2020-01-21 16:23:07
正如Filburt向我展示的正确方法一样,可能的C#解决方案在底部
public List<KeyValuePair<string, string>> GetRelatedEntities (string entityName)
{
List<KeyValuePair<string, string>> retval = new List<KeyValuePair<string, string>>();
RetrieveEntityRequest retrieveBankAccountEntityRequest = new RetrieveEntityRequest
{
EntityFilters = EntityFilters.All,
LogicalName = entityName
};
RetrieveEntityResponse retrieveBankAccountEntityResponse = (RetrieveEntityResponse)service.Execute(retrieveBankAccountEntityRequest);
OneToManyRelationshipMetadata[] relations = retrieveBankAccountEntityResponse.EntityMetadata.OneToManyRelationships;
foreach(OneToManyRelationshipMetadata m in relations)
{
retval.Add(new KeyValuePair<string, string>(m.ReferencingEntity, m.ReferencingAttribute));
}
return retval;
}https://stackoverflow.com/questions/59819200
复制相似问题