Dynamics crm 无法使用CRM SDK FetchXML提取没有绑定帐户的联系人

Dynamics crm 无法使用CRM SDK FetchXML提取没有绑定帐户的联系人,dynamics-crm,microsoft-dynamics,fetchxml,Dynamics Crm,Microsoft Dynamics,Fetchxml,使用下面的fetchxml,它只会拉取帐户已绑定的联系人。我想拉的联系人有一个帐户绑在一起[如果有帐户名],也没有帐户绑在一起的联系人。我有外部连接,但仍然不起作用。下面的fetchxml只提取帐户号绑定的联系人,而不是所有没有帐户信息的活动联系人 <fetch top="50" > <entity name="contact" > <attribute name="emailaddress1&qu

使用下面的fetchxml,它只会拉取帐户已绑定的联系人。我想拉的联系人有一个帐户绑在一起[如果有帐户名],也没有帐户绑在一起的联系人。我有外部连接,但仍然不起作用。下面的fetchxml只提取帐户号绑定的联系人,而不是所有没有帐户信息的活动联系人

<fetch top="50" >
  <entity name="contact" >   
    <attribute name="emailaddress1" />
    <attribute name="lastname" />    
    <attribute name="firstname" />    
    <attribute name="accountidname" />
    <attribute name="accountid" />
    <filter type="and" >
      <condition attribute="statecode" operator="eq" value="1" />
    </filter>
    <link-entity name="account" from="accountid" to="accountid" link-type="outer" >
      <attribute name="name" />
    </link-entity>
  </entity>
</fetch>

我只看到一个问题,应该使用联系人实体中的属性
parentcustomerid
,而不是
accountid

因此,连接条件应为:

完整查询:

<fetch top="50" >
  <entity name="contact" >   
    <attribute name="emailaddress1" />
    <attribute name="lastname" />    
    <attribute name="firstname" />    
    <attribute name="accountidname" />
    <attribute name="accountid" />
    <filter type="and" >
      <condition attribute="statecode" operator="eq" value="1" />
    </filter>
    <link-entity name="account" from="accountid" to="parentcustomerid" link-type="outer" >
      <attribute name="name" />
    </link-entity>
  </entity>
</fetch>


fetchxml看起来是正确的,请使用fetchxml Builder(它是一个XrmToolBox工具)进行测试,并查看您是否看到了正确的检索数据