I have a custom ribbon button on one of my CRM 2011 entities that will effectively disable that entity.
I then would like to refresh the current view on the homepage of that entity. I would like this triggered by JS.
Currently I'm able to refresh the whole parent window which will put me back at the dashboard and not the home page of that entity.
Thanks!
I have a custom ribbon button on one of my CRM 2011 entities that will effectively disable that entity.
I then would like to refresh the current view on the homepage of that entity. I would like this triggered by JS.
Currently I'm able to refresh the whole parent window which will put me back at the dashboard and not the home page of that entity.
Thanks!
Share Improve this question asked Nov 25, 2011 at 16:30 user1231231412user1231231412 1,6592 gold badges26 silver badges42 bronze badges 1- What do you mean by "home page"? The page where you see multiple records of that entity, or the editor page of a single record? and by disable, you mean deactivate? – Renaud Dumont Commented Nov 25, 2011 at 21:08
2 Answers
Reset to default 4Good question. Here are two ways you can do it:
//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();
If someone is ing here for Dynamics 365
Do the following for the custom Ribbon Button:
PrimaryControl
as CrmParameter
to your JS function
function yourJSFunction(primaryControl) {
// Do your stuff
primaryControl.refresh();
}
Example for Xrm.WebApi.online.executeMultiple(...)
:
function yourJSFunction(primaryControl) {
// Create the requests
// ...
Xrm.WebApi.online.executeMultiple(requests)
.then(function (result) {
primaryControl.refresh();
});
}