本文介绍了SetParameter(“ fetchXml”,FetchXml)在CRM 2016在线中不支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有以下代码:

function FilterCasesSubgrid() {
    //var CasesSubgrid = Xrm.Page.getControl("contact").getGrid();
    var CasesSubgrid = window.parent.document.getElementById("contact");

    if(CasesSubgrid==null){
    setTimeout(function () { FilterCasesSubgrid(); }, 2000); //if the grid hasn’t loaded run this again when it has
    return;
    }
    var fetchXml ="<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"+
    "<entity name='contact'>"+
    "<attribute name='fullname' />"+
    "<filter type='and'>"+
    "<condition attribute='fullname' operator='eq' value='s%' />"+
    "</filter>"+
    "</entity>"+
    "</fetch>";
    //Here i set the fetchxml directly to subgrid
    CasesSubgrid.control.SetParameter("fetchXml", fetchXml); //set the fetch xml to the sub grid
    CasesSubgrid.control.Refresh(); //refresh the sub grid using the new fetch xml
}

ERROR刷新子网格:

ERROR :


推荐答案

不支持此代码,因此您不应期望它可以工作。使用可直接访问DOM的任何函数(即 window.parent.document.getElementById )或使用未在不受支持,应避免使用。

This code isnt supported so you shouldnt expect it to work. Using any function which directly accesses the DOM (i.e; window.parent.document.getElementById) or uses function not defined within the MSDN SDK is unsupported and should be avoided.

但是,鉴于您似乎要做的只是添加过滤器,因此可以通过设置现有的FetchXML查询来实现此目的:

However, given that all you seem to be doing is adding a filter, there are supported methods for doing this by setting an existing FetchXML query:

var myView = {
    entityType: 1039, // SavedQuery
    id:"{3A282DA1-5D90-E011-95AE-00155D9CFA02}",
    name: "My Custom View"
}

//Set the view using ContactsIFollow
Xrm.Page.getControl("Contacts").getViewSelector().setCurrentView(myView);

这篇关于SetParameter(“ fetchXml”,FetchXml)在CRM 2016在线中不支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 12:03