Dynamics crm FetchXml查询生成一个';通用SQL错误';但是如果我切换链接的实体,它会工作吗?

Dynamics crm FetchXml查询生成一个';通用SQL错误';但是如果我切换链接的实体,它会工作吗?,dynamics-crm,fetchxml,dynamics-crm-2015,Dynamics Crm,Fetchxml,Dynamics Crm 2015,我试图查询“香草”CRM 2015的产品目录,我的最终目标是按价目表和名称子字符串检索活动产品,目前我正在硬编码我的数据,如下所示: PriceLevel: hardcoded GUID Name: hardcoded "a" 生成的XML如下所示: <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" count="50"> <entity name="

我试图查询“香草”CRM 2015的产品目录,我的最终目标是按价目表和名称子字符串检索活动产品,目前我正在硬编码我的数据,如下所示:

PriceLevel: hardcoded GUID
Name: hardcoded "a"
生成的XML如下所示:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" count="50">
    <entity name="productpricelevel" >
        <attribute name="uomid" />
        <filter type="and">
            <condition attribute="pricelevelid" operator="eq" uitype="pricelevel" value="{7080964d-85df-e411-80ba-00155d0b0c38}" />
        </filter>
        <link-entity name="product" from="productid" to="productid" alias="ac" >
            <attribute name="name" />
            <attribute name="productnumber" />
            <order attribute="productnumber" descending="false" />
            <filter type="and">
                <condition attribute="name" operator="like" value="a" />
                <condition attribute="statecode" operator="eq" value="0" />
            </filter>
        </link-entity>
    </entity>
</fetch>
在尝试识别模式时,我切换了连接,最终得到以下XML:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" count="50" >
    <entity name="product" >
            <attribute name="name" />
            <attribute name="productnumber" />
            <order attribute="productnumber" descending="false" />
            <filter type="and" >
                <condition attribute="name" operator="like" value="a" />
                <condition attribute="statecode" operator="eq" value="0" />
            </filter>
        <link-entity name="productpricelevel" from="productid" to="productid" alias="ac" >
        <attribute name="uomid" />
        <filter type="and" >
            <condition attribute="pricelevelid" operator="eq" uitype="pricelevel" value="{7080964d-85df-e411-80ba-00155d0b0c38}" />
        </filter>
        </link-entity>
    </entity>
</fetch>

这一次,我得到了预期的结果,没有错误

该组织是新的,只包含Sitemap/HTML/JS自定义项(我查询的实体尚未自定义),1033是基础语言,安装并启用了另一种语言,但系统的两个用户中没有任何一个使用它

第一个案子是怎么回事


更新:第一个查询适用于2013年的组织。这开始感觉像是一个bug。

这肯定是一个bug。我猜微软改变了将
QueryBase
查询转换为T-SQL的引擎

本周,我们遇到了与链接实体有关的问题。这是关于以下情况:

.AddCondition("statuscode", ConditionOperator.In, new object[] { 1, 2, 3 });

当应用于
QueryExpression
的主实体时,条件将按预期进行处理。应用于链接实体时失败。在以前的Dynamics CRM版本中,它在两种情况下都能工作。

对我来说也像个bug:)
.AddCondition("statuscode", ConditionOperator.In, new object[] { 1, 2, 3 });