Dynamics crm 包含空值的FetchXML链接实体
我正在尝试使用FetchXML查询CRM。这里是对account实体的查询,它返回10条记录,这里新的\u primaryactivityname字段有Dynamics crm 包含空值的FetchXML链接实体,dynamics-crm,fetchxml,Dynamics Crm,Fetchxml,我正在尝试使用FetchXML查询CRM。这里是对account实体的查询,它返回10条记录,这里新的\u primaryactivityname字段有NULL用于少数记录 <fetch mapping="logical" version="1.0"> <entity name="account"> <attribute name="accountid" />
NULL
用于少数记录
<fetch mapping="logical" version="1.0">
<entity name="account">
<attribute name="accountid" />
<attribute name="name" />
<attribute name="new_primaryactivity" />
</entity>
</fetch>
结果(少于10条记录)忽略新的\u primaryactivityname为NULL
的记录,我在FetchXML查询中缺少什么
除了使用FetchXML之外,我对系统没有太多的访问权限,我参考了一些关于使用该工具帮助构建FetchXML查询的建议,但由于限制,我不能这样做。我认为这是您的过滤器块的位置 按照现在编写的方式,您将
account
和stringmap
与外部联接链接在一起,然后将过滤器应用于结果
我认为您需要在外部联接中执行筛选器,如下所示:
<fetch mapping="logical" version="1.0">
<entity name="account">
<attribute name="accountid" />
<attribute name="name" />
<attribute name="new_primaryactivity" />
<link-entity name="stringmap" from="attributevalue" to="new_primaryactivity" alias="new_primaryactivity_lookup_name" link-type="outer">
<attribute name="value" />
<filter type="and">
<condition attribute="attributename" operator="eq" value="new_primaryactivity" />
<condition attribute="objecttypecode" operator="eq" value="999" />
</filter>
</link-entity>
</entity>
</fetch>
或者,您可以尝试以不同的方式编写过滤器,并显式地允许空值
<fetch mapping="logical" version="1.0">
<entity name="account">
<attribute name="accountid" />
<attribute name="name" />
<attribute name="new_primaryactivity" />
<link-entity name="stringmap" from="attributevalue" to="new_primaryactivity" alias="new_primaryactivity_lookup_name" link-type="outer">
<attribute name="value" />
</link-entity>
<filter type="or">
<condition entityname="new_primaryactivity_lookup_name" attribute="attributename" operator="eq" value="" />
<filter type="and">
<condition entityname="new_primaryactivity_lookup_name" attribute="attributename" operator="eq" value="new_primaryactivity" />
<condition entityname="new_primaryactivity_lookup_name" attribute="objecttypecode" operator="eq" value="999" />
</filter>
</filter>
</entity>
</fetch>
我没有测试过这两个,但希望其中一个对你有用
<fetch mapping="logical" version="1.0">
<entity name="account">
<attribute name="accountid" />
<attribute name="name" />
<attribute name="new_primaryactivity" />
<link-entity name="stringmap" from="attributevalue" to="new_primaryactivity" alias="new_primaryactivity_lookup_name" link-type="outer">
<attribute name="value" />
</link-entity>
<filter type="or">
<condition entityname="new_primaryactivity_lookup_name" attribute="attributename" operator="eq" value="" />
<filter type="and">
<condition entityname="new_primaryactivity_lookup_name" attribute="attributename" operator="eq" value="new_primaryactivity" />
<condition entityname="new_primaryactivity_lookup_name" attribute="objecttypecode" operator="eq" value="999" />
</filter>
</filter>
</entity>
</fetch>