我有这个SQL
查询我试图获取的位置opportunityId
来自机会实体 为谁approvaldocument
尚未创建(批准文档是其他实体的名称)。我认为 fetchxml 不支持此类查询。我是 crm 新手,我的项目位于crm 4.0
版本。
这是sql查询:
Select OpportunityId from opportunity AS c left JOIN (select a.opportunitynameid from opportunity o
JOIN ApprovalDocument a ON
a.opportunitynameid=o.OpportunityId) AS b ON c.OpportunityId=b.opportunitynameid
Where b.opportunitynameid IS NULL and statecode=0
我把它转换成fetchxml
,但这并没有给出正确的结果。
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="opportunity"> <attribute name="opportunityid" />
<link-entity name="approvaldocument" from="opportunitynameid" to="opportunityid" alias="a" link-type="outer"> <attribute name="opportunitynameid" />
</link-entity>
<filter type="and">
<condition entityname="a" attribute="opportunitynameid" operator="null" />
</filter>
</entity>
<fetch/>
本质上,不可能创建高级查找来查询是否存在关系。然而,有几种不同的解决方案可以实现此功能:
解决方法:创建包含完整记录集的营销列表,然后使用与条件相反的方式删除记录。执行此操作的步骤很好地列出在本文。 http://www.powerobjects.com/2009/05/04/accounts-with-no-contacts-and-fun-with-subqueries/
修改 FetchXML 和第三方解决方案:尽管高级查找无法显示“Not In”结果,但基础 FetchXML 确实支持此功能。手动构建此类 Fetch 的示例是此处显示 http://debajmecrm.com/2014/08/27/left-join-with-not-in-operator-in-microsoft-dynamics-crm-2013/。此外,还有一些第三方工具利用此功能直接在高级查找中提供“Not In”功能。我知道的最好的解决方案是.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)