2015-04-01 48 views
0

我需要根據創建entity2(數學運算)的更新entity1entity1形式是開放的。刷新形式(按Ctrl + F5)不火檢索插件在2011年CRM

當我刷新entity1表單時,該字段具有舊值,直到我關閉並打開entity1表單(緩存問題)。

我發現它不會觸發Retrieve Plugin。有沒有辦法通過刷新表單來克服這個問題?

回答

0

首先,最重要的是:最新的CRM有Xrm.Page.data.refresh()「自動更新」表單數據(更不用說通過插件更改字段時自動刷新的事實)。

如果升級是不是一種選擇,我會設置一個「守望者」的功能是這樣的:

// attach to Form Load event 
function keepYourFieldInSync() {  
    setInterval(function(){ 
     var current = Xrm.Page.getAttribute("yourField"); 

     // Not shown here, basically get the updated value from server 
     var fetched = fetch_yourField_value_from_OData_or_SOAP();   

     if(fetched != current){ 
      Xrm.Page.getAttribute("yourField").setValue(fetched); 

      // if users aren't allowed to set the field by hand, I'd also include this 
      // and customize the field to be readonly 
      Xrm.Page.getAttribute("yourField").setSubmitMode("never"); 
     } 
    }, 1000); // keep it above 500 to avoid killing the browser 
} 

我用一個「絕招」這樣的認識在行情狀態改變(另一個用戶將其激活而這個用戶正在研究草案),並且它工作得很好。