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



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

所以连接条件应该是:

<link-entity name="account" from="accountid" to="parentcustomerid" link-type="outer" >

完整查询:

<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只是guid而不是查找,而且是一个虚拟字段。阅读更多

最新更新