我正在尝试为 Microsoft Dynamics CRM 用户提供一个快速筛选选项,使他们能够快速对主页视图进行子筛选。
客户要求提供比过滤器更简单的体验,因此我添加了一个按钮,用于启动 HTML Web 资源以收集他们的搜索条件。它使用他们的输入来创建获取 XML,然后将其传递回主页上的网格。这在 UCI 之前有效,但不再适用于 UCI。我的 HTML Web 资源中的代码似乎无法“找到”控件或将 XML 推送到它上面。
我之前的 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();