Filter 如何使用fetch进行过滤以获得准确的结果?
我需要获取所有在Filter 如何使用fetch进行过滤以获得准确的结果?,filter,dynamics-crm,fetch,dynamics-crm-2016,fetchxml,Filter,Dynamics Crm,Fetch,Dynamics Crm 2016,Fetchxml,我需要获取所有在状态下有电话呼叫的帐户而不是打开,因此我创建了一个关于fetch的查询并得到了一些结果 检查结果后,我发现我得到的所有帐户中至少有1个电话呼叫未打开,但我需要得到所有连接的电话呼叫未打开的帐户(甚至不能有1个处于打开状态)是否可以通过提取来完成 **“未打开”是指已取消或已完成的状态 以下是我的获取查询: @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'
状态下有电话呼叫的帐户
而不是打开
,因此我创建了一个关于fetch的查询并得到了一些结果
检查结果后,我发现我得到的所有帐户中至少有1个电话呼叫未打开,但我需要得到所有连接的电话呼叫未打开的帐户(甚至不能有1个处于打开状态)是否可以通过提取来完成
**“未打开”是指已取消或已完成的状态
以下是我的获取查询:
@"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>
<entity name='account'>
<attribute name='name' />
<order attribute='accountamount' descending='true' />
<link-entity name='phonecall' from='regardingobjectid' to='accountid' alias='ab'>
<filter type='and'>
<condition attribute='statecode' operator='ne' value='0' />
</filter>
</link-entity>
</entity>
</fetch>";
@”
";
您要查找的是不匹配查询。这可以通过使用fetchxml的两个查询来实现
第一次查询:您必须提取所有打开电话的帐户
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" >
<entity name="account" >
<attribute name="accountid" />
<order attribute="accountamount" descending="true" />
<link-entity name="phonecall" from="regardingobjectid" to="accountid" alias="ab" >
<filter type="and" >
<condition attribute="statecode" operator="eq" value="0" />
</filter>
</link-entity>
</entity>
</fetch>
请显示您尝试的查询。@ArunVinoth我已将其添加到我的问题arun,您的意思是获得2个实体集合:1-所有帐户2-所有有开放电话呼叫的帐户,并从所有帐户中删除所有有开放电话呼叫的帐户?
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" >
<entity name="account" >
<attribute name="name" />
<attribute name="primarycontactid" />
<attribute name="telephone1" />
<attribute name="accountid" />
<order attribute="name" descending="false" />
<filter type="and" >
<condition attribute="accountid" operator="not-in" >
<value><GUID of ACCOUNT1 with OPEN PHONECALL></value>
<value><GUID of ACCOUNT2 with OPEN PHONECALL></value>
<value><GUID of ACCOUNT3 with OPEN PHONECALL></value>
</condition>
</filter>
</entity>
</fetch>