【发布时间】:2026-01-20 12:05:02
【问题描述】:
我在数据库中有 2 个实体;约会和电子邮件。我想编写一个搜索函数来获取包含用户输入的字符串的所有约会和电子邮件。但是,我想根据它是哪个实体来搜索不同的属性。例如:我想获取所有属性 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 中做什么?还是我构建查询的方式有问题?
【问题讨论】:
标签: dynamics-crm microsoft-dynamics dynamics-crm-2013 dynamics-365 fetchxml