2013-09-24 61 views
1

我想选择与n使用fetchXml的特定实体无关的帐户。我试过如下:fetchXml:如何选择*不具有特定类型的链接实体的帐户

<fetch mapping="logical" count="50" version="1.0"> 
    <entity name="account"> 
     <attribute name="name" /> 
     <order attribute="name" /> 
     <link-entity name="xy_accounthierarchynode" from="xy_accountid" 
          to="accountid" link-type="outer"> 
      <filter> 
       <condition attribute="xy_accounthierarchynodeid" 
          operator="null" /> 
      </filter> 
     </link-entity> 
    </entity> 
</fetch> 

此查询的预期结果是不具有相关xy_accounthierarchynode所有acounts。但我收到的都是帐户。过滤条件似乎只是被忽略...

我做错了什么?

回答

2

坏消息是这是不可能的CRM 2011由于你使用的是“外部”加入让所有账户。

有一些解决这个问题的创造性方法。例如,要获取没有机会的账户或联系人,您可以使用this博客文章中介绍的营销列表方法。

好消息是CRM 2013将于下个月发布,它支持“左外”连接,它将为您提供所需的功能。

0

试试这个请:

<fetch distinct="false" no-lock="false" mapping="logical"> 
    <entity name="account"> 
    <attribute name="name" /> 
    <filter type="and"> 
     <condition attribute="accountid" operator="null" /> 
    </filter> 
    <link-entity name="xy_accounthierarchynode" to="accountid" from="xy_accountid" link-type="outer" alias="n_0" /> 
    </entity> 
</fetch> 
相关问题