标签: fetchxml

你能写一个FetchXML查询来获得1:很多关系吗?

是否可以编写一个获取根实体和多个子节点的FetchXML查询?我所能做的就是1:1.

dynamics-crm fetchxml

2
推荐指数
2
解决办法
4979
查看次数

FetchXML中的日期参数

我在SSRS 2008中使用FetchXML来创建CRM 2011的报告.我想在报告中包含参数,以便您可以显示From Date - To Date之间的记录.这是我到目前为止的查询.

<fetch>
      <entity name="appointment">
        <attribute name="scheduledstart" />
        <link-entity name="systemuser" from="systemuserid" to="ownerid">
            <attribute name="firstname" alias="ownerFirstName" />
            <attribute name="lastname" alias="ownerLastName" />
        </link-entity>
        <link-entity name="contact" from="contactid" to="new_contactperson">
            <attribute name="parentcustomerid" alias="parentaccount" />
            <attribute name="new_businessunit" alias="businessunit" />
        </link-entity>
        <attribute name="new_contactperson" />
        <attribute name="subject" />
        <attribute name="new_coldernotes" />
    <link-entity name="activityparty" from="activityid" to="activityid">
    <attribute name="participationtypemask" alias="participationtypemask" />
        <filter>
        <condition attribute="participationtypemask" operator="eq" value="9" />
        </filter>
        <link-entity name="systemuser" from="systemuserid" to="partyid">
            <attribute name="fullname" />
        </link-entity>
    </link-entity>
    <order attribute="scheduledstart" descending="true" />
      </entity>
</fetch>
Run Code Online (Sandbox Code Playgroud)

我怎么做到这样我可以在日期之间过滤?

谢谢!

dynamics-crm reporting-services ssrs-2008 fetchxml dynamics-crm-2011

2
推荐指数
1
解决办法
4409
查看次数

为CRM 2011编写Native SQL

我想知道我可以编写本机SQL来添加或删除操作而不是使用Query Expression或FetchXML等.我知道Query Expression非常有用,但我真正关心的是性能,我认为编写SQL可能比其他更快.

crm dynamics-crm query-expressions fetchxml dynamics-crm-2011

2
推荐指数
1
解决办法
2391
查看次数

服务器端Fetchxml返回不同的结果

我们的一个程序允许用户通过选择视图然后点击功能区按钮批量插入相关记录.保存表单,设置标志,然后插件完成其工作.

我们正在使用带有视图选择器的子网格,以便用户动态选择或创建自己的视图.选择视图后,将显示结果数(提供的值为lte 5k).

当插件运行fetchxml服务器端(检索userquery或savedquery,然后是Retrieve + FetchExpression)时,结果会发生变化.我们不仅获得不同数量的记录,而且还有一些记录不同.

我们的结论是,这个问题与时区有关.一些过滤器包括"on-or-after"运算符以及日期值.例:

<filter type="and">
  <condition attribute="modifiedon" operator="on-or-after" value="2011-01-01" />
  <condition attribute="modifiedon" operator="on-or-before" value="2011-12-31" />
</filter>
Run Code Online (Sandbox Code Playgroud)

该插件以管理员身份运行.更改插件用户无效 - 就像使用FetchExpression从CRM中提取记录时不考虑当前用户时区一样.

如何确保fetchxml表达式在客户端和服务器端返回相同的结果?

可能相关:MSDN线程.

谢谢你的时间.

编辑:按照Daryl的建议,我运行了一条SQL跟踪.结果令人费解.对于客户端查询,日期是正确偏移的(从CRM运行,即高级查找) - 这意味着fetchxml使用用户的时区设置正确转换.服务器端的同一查询不会发生这种情况; 输出SQL包含"原样"的日期过滤器,没有时区偏移量.无论查询执行上下文的来源如何,我都假设发生了相同的翻译.

编辑2:隐藏的代码区域(我的上一个调试手段)中的标志阻止插件在运行用户的上下文中实例化服务.一切都运行良好.感谢大家的时间和帮助,非常感谢.

plugins fetchxml dynamics-crm-2011

2
推荐指数
1
解决办法
2297
查看次数

Fetchxml 获取具有当前用户作为所有者 CRM 2013 的活跃机会的联系人

目标:创建一个视图,可以显示当前用户拥有的所有联系人,以及当前用户拥有的任何具有关联机会的联系人。

问题:即使在查看了我可以搜索的有关 fetchxml 或链接实体的信息后,我也没有很好的掌握它们。当我尝试使用我的 fetch 语句构建视图时,它不会带回任何东西,所以我假设我构建它不正确。

这是我到目前为止所做的声明:

<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>
                    <entity name='contact'>
                      //big list of attributes
                      <order attribute='fullname' descending='false' />
                      <link-entity name='opportunity' from='customerid' to='contactid' alias='aa'>
                       <filter type='and'>
                         <condition attribute='ownerid' operator='eq-userid' />
                       </filter>
                      </link-entity>
                      <filter type='or'>
                        <condition attribute='ownerid' operator='eq-userid' />
                      </filter>
                    </entity>
                </fetch>
Run Code Online (Sandbox Code Playgroud)

任何提示将不胜感激,谢谢!

dynamics-crm fetch fetchxml dynamics-crm-2011 dynamics-crm-2013

1
推荐指数
1
解决办法
2184
查看次数

如何在我的插件 - CRM 2011上使用OrganizationServiceProxy?

我需要在CRM插件中使用fetch xml,我在这里找到了一个如何做到这一点的示例:

string groupby1 = @" 
    <fetch distinct='false' mapping='logical' aggregate='true'> 
     <entity name='opportunity'>
      <attribute name='name' alias='opportunity_count' aggregate='countcolumn' />  
      <attribute name='ownerid' alias='ownerid' groupby='true' />
      <attribute name='createdon' alias='createdon' /> 
      <attribute name='customerid' alias='customerid' /> 
     </entity> 
    </fetch>";

    EntityCollection groupby1_result = orgProxy.RetrieveMultiple(new FetchExpression(groupby1));
Run Code Online (Sandbox Code Playgroud)

但是还有一些我不知道如何使用的东西,或者它在哪里使用......它的部分内容如下:

orgProxy.RetrieveMultiple(new FetchExpression(groupby1));
Run Code Online (Sandbox Code Playgroud)

我知道它是OrganizationServiceProxy的一个对象,但它在插件类中的位置是什么?我找不到.

plugins fetchxml dynamics-crm-2011

0
推荐指数
1
解决办法
673
查看次数