我在一个CRM 2011实体上有一个自定义功能区按钮,可以有效地禁用该实体。
然后,我想刷新该实体主页上的当前视图。我想由JS触发。
当前,我能够刷新整个父窗口,这将使我回到仪表板而不是该实体的主页。
谢谢!
好问题。您可以通过以下两种方式进行操作:
//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();
对自定义功能区按钮执行以下操作:
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();
});
}