我的某个CRM 2011实体上有一个自定义功能区按钮,可以有效地禁用该实体。
然后我想刷新该实体主页上的当前视图。我想这是由JS引发的。
目前,我可以刷新整个父窗口,这将使我回到仪表板而不是该实体的主页。
谢谢!
答案 0 :(得分:4)
好问题。这有两种方法可以做到:
//refreshes the entire element in the parent window that contains the view
window.parent.opener.location.reload();
//refreshes just the grid control that contains the view (probably what you're looking for)
window.parent.opener.document.getElementById("crmGrid").control.refresh();
答案 1 :(得分:3)
对自定义功能区按钮执行以下操作:
PrimaryControl
作为CrmParameter
添加到您的JS函数中
function yourJSFunction(primaryControl) {
// Do your stuff
primaryControl.refresh();
}
Xrm.WebApi.online.executeMultiple(...)
的示例:
function yourJSFunction(primaryControl) {
// Create the requests
// ...
Xrm.WebApi.online.executeMultiple(requests)
.then(function (result) {
primaryControl.refresh();
});
}