2014-10-09 87 views
0

我已经使用类似的代码来加载具有自定义FetchXML的网格,但我无法得到这个工作。我得到一个Out of Stack空间错误。我试图改变计时器,但没有帮助。 CRM中有什么改变我不知道?动态CRM 2013 SetParameter堆栈空间不足

功能UpdateSubGridRelatedMatters(){

var grid = document.getElementById("RelatedMTIGrid"); 

    //If this method is called from the form OnLoad, make sure that the grid is loaded before proceeding 
    //Included extra null check as a rollup 5 fix 


    var relatedMatterID = Xrm.Page.data.entity.attributes.get("sage_relatedmatter").getValue()[0].id; 

    //if (relatedMatterID != null) { 
     //Update the fetchXML that will be used by the grid. 
     var fetchXml = ""; 
     fetchXml += "<fetch version=\" 1.0\" output-format=\" xml-platform\" mapping=\" logical\" distinct=\" false\" >"; 
     fetchXml += "<attribute name=\" sage_mtiid\" />"; 
     fetchXml += "<attribute name=\" sage_name\" />"; 
     fetchXml += "<attribute name=\" createdon\" />"; 
     fetchXml += "<attribute name=\" sage_scientistisconsultant\" />"; 
     fetchXml += "<attribute name=\" sage_secondlab\" />"; 
     fetchXml += "<attribute name=\" sage_scientisthascfn\" />"; 
     fetchXml += "<attribute name=\" sage_scientist\" />"; 
     fetchXml += "<attribute name=\" sage_redlines\" />"; 
     fetchXml += "<attribute name=\" sage_providermatterid\" />"; 
     fetchXml += "<attribute name=\" sage_organizationcontact\" />"; 
     fetchXml += "<attribute name=\" sage_organization\" />"; 
     fetchXml += "<attribute name=\" sage_matterid\" />"; 
     fetchXml += "<attribute name=\" sage_origin\" />"; 
     fetchXml += "<attribute name=\" sage_materialtype\" />"; 
     fetchXml += "<attribute name=\" sage_hostmatterid\" />"; 
     fetchXml += "<attribute name=\" sage_hostcontact\" />"; 
     fetchXml += "<attribute name=\" sage_host\" />"; 
     fetchXml += "<attribute name=\" sage_executedbyhhmi\" />"; 
     fetchXml += "<attribute name=\" createdby\" />"; 
     fetchXml += "<order attribute=\" createdon\" descending=\" false\" />"; 
     fetchXml += "<order attribute=\" sage_name\" descending=\" false\" />"; 
     fetchXml += "<filter type=\" and\" >"; 
     fetchXml += "<condition attribute=\" sage_relatedmtiid\" operator=\" eq\" value=\" " + relatedMatterID + "\" />"; 
     fetchXml += "</filter>"; 
     fetchXml += "</entity>"; 
     fetchXml += "</fetch>"; 


     if (grid == null || grid.readyState != "complete") { 
      //The subgrid hasn't loaded, wait 1 second and then try again  
      setTimeout(UpdateSubGridRelatedMatters(), 3000); 
      return; 
     } 

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

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

    // } 

} 

回答

2

你打电话UpdateSubGridRelatedMatters和传球的结果,而不是函数本身作为一个参数的setTimeout这使你进入一个递归循环因此计算器。

变化

setTimeout(UpdateSubGridRelatedMatters(), 3000); 

setTimeout(UpdateSubGridRelatedMatters, 3000); 
+0

尼斯赶上感谢 – GoBeavs 2014-10-09 19:22:10