简体   繁体   English

在 UCI 中使用 JavaScript 从 HTML 中过滤 Dynamics CRM 帐户主页

[英]Filter Dynamics CRM Account Homepage from HTML with JavaScript in UCI

I am trying to provide a quick filter option for Microsoft Dynamics CRM users that allows them to quickly sub-filter a homepage view.我正在尝试为 Microsoft Dynamics CRM 用户提供一个快速筛选选项,允许他们快速对主页视图进行子筛选。

The customer requirement is to allow an easier experience than what the filters allow, so I added a button that launches an HTML web resource to collect their search criteria.客户要求提供比过滤器允许的更简单的体验,因此我添加了一个按钮来启动 HTML Web 资源以收集他们的搜索条件。 It uses their input to create fetch XML and then passes that back to the grid on the main page.它使用他们的输入来创建获取 XML,然后将其传递回主页上的网格。 This worked prior to the UCI, but no longer works with the UCI.这在 UCI 之前有效,但不再适用于 UCI。 The code in my HTML web resource doesn't seem to be able to "find" the control or push the XML onto it.我的 HTML Web 资源中的代码似乎无法“找到”控件或将 XML 推送到其上。

My previous HTML resource relied on something similar to the following script to build the XML and push it to the account homepage:我之前的 HTML 资源依赖于类似于以下脚本的内容来构建 XML 并将其推送到帐户主页:


var city = "Tampa";  //this input is obtained from the user input in the actual HTML 

var fetchType ='<condition attribute="new_orgtype" operator="in"><value>1</value><value>2</value><value>5</value></condition>';

var cityXML = '<condition attribute="address1_city" operator="like" value="'+city+'%"/>';

//concatenate input into a complete fetch XML
var effectiveFetchXml = '<fetch distinct="false" useraworderby="false" no-lock="false" mapping="logical" page="1" count="250" returntotalrecordcount="true"><entity name="account"><attribute name="name" /><attribute name="address1_city" /><attribute name="primarycontactid" /><attribute name="telephone1" /><attribute name="address1_stateorprovince" /><attribute name="parentaccountid" /><attribute name="address1_line1" /><attribute name="websiteurl" /><attribute name="fax" /><attribute name="address1_postalcode" /><attribute name="accountid" /><attribute name="name" /><attribute name="parentaccountid" /><attribute name="primarycontactid" /><attribute name="telephone1" /><attribute name="fax" /><attribute name="websiteurl" /><attribute name="address1_line1" /><attribute name="address1_city" /><attribute name="address1_stateorprovince" /><attribute name="address1_postalcode" /><filter type="and"><condition attribute="statecode" operator="eq" value="0" />'+fetchType+cityXML+'</filter><order attribute="name" descending="false" /></entity></fetch>';

//identify the grid on the main page
var grid = window.opener.document.getElementById("crmGrid");

//Inject the new fetchXml
grid.control.SetParameter("fetchXml", effectiveFetchXml);
grid.control.SetParameter("effectiveFetchXml", effectiveFetchXml);

//Force the subgrid to Refresh
grid.control.Refresh();

This is the reason we must not do any unsupported customizations like this.这就是我们不能进行任何此类不受支持的自定义的原因。 Accessing DOM elements like crmGrid is not a recommended way - Microsoft always mention that in documentation that it may break in future versions.不推荐访问像crmGrid这样的 DOM 元素——微软总是在文档中提到它在未来版本中可能会中断。

Alternatively - Try to rebuild your requirement in HTML webresource totally, including Grid view and filters/search.或者 - 尝试在 HTML 网络资源中完全重建您的需求,包括网格视图和过滤器/搜索。 Also you can build PCF controls to render the UI natively.您还可以构建 PCF 控件以本机呈现 UI。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Dynamics CRM 365(UCI) 中的 javascript 中分配事件 - Assign event in javasscript in Dynamics CRM 365(UCI) 在动态 CRM 中从对话框 window 运行 JavaScript - Run JavaScript from Dialog window in dynamics CRM 如何确定 Dynamics XRM javascript 是从统一接口 (UCI) 还是从旧版 Web 客户端调用? - How to determine if Dynamics XRM javascript is being invoked from the unified interface (UCI) or the legacy web-client? Dynamics CRM JavaScript 平均值 - Dynamics CRM JavaScript Average 从 MS Dynamics CRM 中的 html webresource 窗口传递数据 - Pass data from html webresource window in MS Dynamics CRM 动力学crm。 从javascript问题启动对话框处理向导 - dynamics crm. launch dialog process wizard from javascript issue Java脚本通过“自定义”按钮在Dynamics CRM中创建和更新记录 - Javascript Create and Update Record In Dynamics CRM from Custom Button 使用JavaScript中的ODATA从Sharepoint页面在Dynamics CRM上运行查询 - Run Query on Dynamics CRM from Sharepoint Page using ODATA in JavaScript Javascript-从MS Dynamics CRM Online添加和检索数据 - Javascript - Add and retrieve data from MS Dynamics CRM Online 来自外部站点的Dynamics CRM Web API(JavaScript) - Dynamics CRM Web API from external site (javascript)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM