2015-04-01 49 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 
} 

我用一个“绝招”这样的认识在行情状态改变(另一个用户将其激活而这个用户正在研究草案),并且它工作得很好。