使用UCI中的JavaScript从HTML过滤Dynamics CRM帐户首页

问题描述 投票:0回答:1

我正在尝试为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();
javascript dynamics-crm microsoft-dynamics dynamics-crm-uci
1个回答
0
投票

这是我们不得执行任何不受支持的自定义的原因。不建议使用诸如crmGrid之类的DOM元素-Microsoft始终在文档中提到在将来的版本中可能会破坏它。

或者-尝试完全重建HTML Webresource中的需求,包括网格视图和过滤器/搜索。您也可以构建PCF控件以本地呈现UI。

© www.soinside.com 2019 - 2024. All rights reserved.