Dynamics crm 如何在fetchXML中基于实体查询不同属性上的关键字?
我在数据库中有2个实体;预约和电子邮件。我想写一个搜索函数,获取所有包含用户输入字符串的约会和电子邮件。但是,我想根据它是哪个实体来搜索不同的属性。例如:我想获取所有属性为Dynamics crm 如何在fetchXML中基于实体查询不同属性上的关键字?,dynamics-crm,microsoft-dynamics,dynamics-crm-2013,dynamics-365,fetchxml,Dynamics Crm,Microsoft Dynamics,Dynamics Crm 2013,Dynamics 365,Fetchxml,我在数据库中有2个实体;预约和电子邮件。我想写一个搜索函数,获取所有包含用户输入字符串的约会和电子邮件。但是,我想根据它是哪个实体来搜索不同的属性。例如:我想获取所有属性为subject且包含字符串“meeting today”的约会,我还想获取属性为description且包含相同字符串的所有电子邮件。因此,简单来说,只搜索主题行中的约会,只搜索电子邮件的描述 以下是迄今为止我的fetchXml的外观: <fetch count="10" distinct="true" mapping=
subject
且包含字符串“meeting today”的约会,我还想获取属性为description
且包含相同字符串的所有电子邮件。因此,简单来说,只搜索主题行中的约会,只搜索电子邮件的描述
以下是迄今为止我的fetchXml的外观:
<fetch count="10" distinct="true" mapping="logical" no-lock="true" output-format="xml-platform" page="1" returntotalrecordcount="false" version="1.0">
<entity name="activitypointer">
<attribute name="subject"/>
<attribute name="description"/>
<attribute name="activitytypecode"/>
<filter type="or">
<condition attribute="activitytypecode" operator="like">
<value>Email</value>
</condition>
<filter type="and">
<condition attribute="description" operator="like" value="%meeting today%"/>
</filter>
</filter>
<filter type="or">
<condition attribute="activitytypecode" operator="like">
<value>Appointment</value>
</condition>
<filter type="and">
<condition attribute="subject" operator="like" value="%meeting today%"/>
</filter>
</filter>
</entity>
</fetch>
电子邮件
约会
然而,这似乎并没有夺回任何记录。在查询单个实体类型时,我可以成功地获取记录,但放置两个过滤器不会返回任何内容。我所要求的在fetchXML中可以实现吗?或者我如何构造查询有问题吗?我刚刚在我的环境中做了一个快速测试,这很有效。在XrmToolBox fetchxml builder中编辑/测试之前,您可以在高级查找和下载fetchxml中构建此类查询
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >
<entity name="activitypointer" >
<attribute name="activitytypecode" />
<attribute name="subject" />
<filter type="and" >
<filter type="or" >
<filter type="and" >
<condition attribute="activitytypecode" operator="eq" value="4202" />
<condition attribute="subject" operator="like" value="%test%" />
</filter>
<filter type="and" >
<condition attribute="activitytypecode" operator="eq" value="4201" />
<condition attribute="description" operator="like" value="%test%" />
</filter>
</filter>
</filter>
</entity>
</fetch>