【问题标题】:Unable to pull contacts with NO accounts tied using CRM SDK FetchXML无法提取没有使用 CRM SDK FetchXML 绑定的帐户的联系人
【发布时间】:2021-01-08 13:40:10
【问题描述】:

使用下面的 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>

【问题讨论】:

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

标签: dynamics-crm microsoft-dynamics fetchxml


【解决方案1】:

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

所以连接条件应该是:

&lt;link-entity name="account" from="accountid" to="parentcustomerid" link-type="outer" &gt;

完整查询:

<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>

看起来这个accountid in contact 只是指导而不是查找,而且是一个虚拟字段。 Read more

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多