Hi All,
We are in the process of first upgrade from CRM2011 to CRM365 on premise.
for the first stage of update we are leaving the "Use legacy form rendering" in system setting equal to yes.
I try to removes the records in the subgrid after changing a value of a drop down and then the subgrid should be refreshed on the screen using the below function.
function onrefreshRespondents() {
document.getElementById("Respondents").control.initialize(); //--> I also removed this unsupported line but still not working
var control = Xrm.Page.ui.controls.get("Respondents");
control.refresh();
}
the above code works in 2011 but it does not refresh the subgrid in CRM365.
any suggestion how I can make it work?
Thanks,
Maryam
*This post is locked for comments
I figured out the issue
If the rendering is set to legacy you have to have this unsupported line part in there otherwise will not work
document.getElementById("Respondents").control.initialize();
var control = Xrm.Page.ui.controls.get("Respondents");
control.refresh();
I also changed the location of my referesh function as it was on a async method and was not hitting the refresh all the time .
Tahnk you for all your help
Thanks Ravi,
I did exactly what you asked.
Removed the first line.
Checked the Subgrid name in the form . It is Respondents.
The only difference I see between crm365 and CRM2011 when I debug is
When I add the control to watch in crm365 it shows Object(Mscrm.InlineSubGridControlViewWarpper) in the 2011 it is not viewwrapper though. Please see the below image
Please note
I also wrote the following lines
function onrefreshRespondents() {
//document.getElementById("Respondents").control.initialize();
var control = Xrm.Page.ui.controls.get("Respondents");
var t = control.getControlType() --> This returned Subgrod
test(); --> When I put the break ppoint inside this test function I saw Responents as name of my grid so my naming is fine as well
control.refresh();
}
function test() {
Xrm.Page.ui.controls.get(
function(ctrl, i) {
if(ctrl.getControlType() == "subgrid")
console.log(ctrl.getName()
);
});;
}
Any help would be very much appreciated
Thanks Giani but this will refresh the whole page . I would like to refersh the Grid only
Hi Maryam,
The code you have mentioned should work after removing the unsupported line. Please check if the name of the subgrid is same. If the name of subgrid is same then it would be something else. Try debugging to see if the method is actually triggered.
---------------
function onrefreshRespondents() {
var control = Xrm.Page.ui.controls.get("Respondents");
control.refresh();
}
---------------
Hope this helps.
Dear Maryam
Could you try the one-liner: " Xrm.Page.data.refresh(); " in your function instead of your code?
Kind Regards
Giani Noyez
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156