2014-10-09 42 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