Dynamics CRM 2015 Online: SubGrid's controlSetParameter方

Dynamics CRM 2015 Online: SubGrid's control.SetParameter method is not available

本文关键字:controlSetParameter SubGrid CRM 2015 Online Dynamics      更新时间:2023-09-26

我试图在CRM 2015在线中填充fetchXml结果的子网格。一开始的一个问题是document.getElementById("leadUmbrellaGrid");返回null

function filterSubGrid() {
    var leadwithSameNameGrid = Xrm.Page.getControl("leadUmbrellaGrid").getGrid();//HAVE TRIED window.parent.document.getElementById("leadUmbrellaGrid"); //grid to filter
    var currentleadId = Xrm.Page.data.entity.getId();;
    if (leadwithSameNameGrid == null) {
        setTimeout('filterSubGrid()', 500);
        return;
    }
    //fetch xml code 
    var fetchXml = "<fetchxml goes here>";

    leadwithSameNameGrid.control.SetParameter("fetchXml", fetchXml); //set the fetch xml to the sub grid   
    leadwithSameNameGrid.control.refresh(); //refresh the sub grid using the new fetch xml
}

I have through this and this

我也尝试了window.parent.document.getElementById,但在这两种情况下,.control是空的或未定义的,并以:

结束:

TypeError:无法获取未定义或空引用的属性'SetParameter'

感谢你的帮助/提示。谢谢你,

解决方案如下:

  1. 我们需要使用window.parent.document.getElementById

  2. 等待control加载到DOM

那么代码应该是这样的:

function filterSubGrid() 
{
    var leadwithSameNameGrid = window.parent.document.getElementById("leadUmbrellaGrid");
    var currentleadId = Xrm.Page.data.entity.getId();;
    if (leadwithSameNameGrid == null) 
    {
        setTimeout(filterSubGrid, 500);
        return;
    }
    //fetch xml code 
    var fetchXml = "<fetchxml goes here>";
    if (leadwithSameNameGrid.control != null) 
    {
        leadwithSameNameGrid.control.SetParameter("fetchXml", fetchXml); //set the fetch xml to the sub grid   
        leadwithSameNameGrid.control.refresh(); //refresh the sub grid using the new fetch xml
    } 
    else 
    {
        setTimeout(filterSubGrid, 500);
    }
}
function filterSubGrid() {
        var leadwithSameNameGrid = window.parent.document.getElementById("leadUmbrellaGrid");
        var currentleadId = Xrm.Page.data.entity.getId();;
        if (leadwithSameNameGrid == null) {
            setTimeout('filterSubGrid()', 500);
            return;
        }
        //fetch xml code 
        var fetchXml = "<fetchxml goes here>";
        if (relatedProjectsSubGrid.control != null) {
        leadwithSameNameGrid.control.SetParameter("fetchXml", fetchXml); //set the fetch xml to the sub grid   
        leadwithSameNameGrid.control.refresh(); //refresh the sub grid using the new fetch xml
          } else {
        setTimeout('filterSubGrid()', 500);
        }
    }

我试过这个,但不太明白你从哪里得到的"relatedProjectsSubGrid"。这在CRM 7.1中仍然有效吗?由于

相关文章:
  • 没有找到相关文章