Dynamics crm 2011 限制CRM online 2015中FetchXML查询的结果
我正在使用一种服务,它可以从CRM在线获取数据,并将其传输到SQL数据库以用于报告目的。我使用下面的fetchxml查询来查询CRMDynamics crm 2011 限制CRM online 2015中FetchXML查询的结果,dynamics-crm-2011,crm,dynamics-crm-online,fetchxml,Dynamics Crm 2011,Crm,Dynamics Crm Online,Fetchxml,我正在使用一种服务,它可以从CRM在线获取数据,并将其传输到SQL数据库以用于报告目的。我使用下面的fetchxml查询来查询CRM string fetchXml = string.Format(@"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'> <entity name='new_stude
string fetchXml = string.Format(@"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
<entity name='new_studentinformation' enableprefiltering ='1' prefilterparametername='CRM_Filterednew_studentinformation'>
<attribute name='new_studentid' />
<attribute name='new_primaryhomeroom' />
<attribute name='new_lastname' />
<attribute name='new_firstname' />
<attribute name='new_busnumber' />
<attribute name='new_schoolname' />
<attribute name='new_gradecode' />
<attribute name='modifiedon' />
<attribute name='new_studentinformationid' />
<filter type='and'>
<condition attribute='modifiedon' value='{0}' operator='on-or-after'/>
</filter>
<order attribute='modifiedon' descending='true' />
<link-entity name='annotation' from='objectid' to='new_studentinformationid' alias='Notes' link-type='outer'>
<attribute name='documentbody'/>
<filter type='and'>
<condition attribute='createdon' value='{0}' operator='on-or-after'/>
</filter>
<order attribute='createdon' descending='true' />
</link-entity>
</entity>
</fetch>"
string fetchXml=string.Format(@)
"
在Notes实体中,每条记录都有多个附加图像,但我只想传输最新的图片。我尝试在order属性中使用createdon
,但它会一直将图像与记录一起带到最旧的记录。我只希望它带最新的图像并停止,然后移动到下一条记录。
如何将其限制为仅查询记录附带的最新图像?不幸的是
不允许这样做
如果您想快速绕过此限制,您可以这样做(我们一直在规范失控时这样做):
注释
到您的新的\u学生信息
实体(将其保留在表单之外)new\u studentinformation
(Pre-Op,Sync,用于Retrieve和RetrieveMultiple)上注册一个插件,在该插件中,您用对报告中所需记录的引用填充新属性。我预计这最多需要15分钟链接实体
中的属性从
切换到新属性奖励:如果插件设计正确,自定义属性中的引用(以及您的报告)将自动更新。我为您的问题提供了一个简单的解决方案,可以节省您制作插件的时间和精力 您应该创建一个javascript资源,在表单上添加一个隐藏字段。 在OnSave事件上运行javascript。将该文档正文存储在文本视图中。 检索图像时,只需查询文档正文文本区域。
这听起来可能是一个黑客行为!但它会提高代码的效率。因此,为了简单起见,您可以说,每当在注释中添加新图像时,该字段都会更新为最新值,并且查询会变成这样:谢谢您,Alex,除了您的answe,我没有使用插件r将我放在正确的路径上,我解决了这个问题。你建议我如何将图像的文档体保存在文本字段中?如果我使用javascript将文档体保存在文本区域中。页面加载时它只加载一次,如果我添加另一个图像会怎么样?我必须手动刷新页面?我不倾向于这样做。