Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Forcing the Subgrid in CRM365 be refreshed with Use Legacy rendering set to yes

Posted on by 315

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

  • Verified answer
    Maryam Profile Picture
    Maryam 315 on at
    RE: Forcing the Subgrid in CRM365 be refreshed with Use Legacy rendering set to yes

    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

  • Maryam Profile Picture
    Maryam 315 on at
    RE: Forcing the Subgrid in CRM365 be refreshed with Use Legacy rendering set to yes

    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

    Capturegrid.PNG

    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

  • Maryam Profile Picture
    Maryam 315 on at
    RE: Forcing the Subgrid in CRM365 be refreshed with Use Legacy rendering set to yes

    Thanks Giani but this will refresh the whole page . I would like to refersh the Grid only

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Forcing the Subgrid in CRM365 be refreshed with Use Legacy rendering set to yes

    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.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Forcing the Subgrid in CRM365 be refreshed with Use Legacy rendering set to yes

    Dear Maryam

    Could you try the one-liner: " Xrm.Page.data.refresh(); " in your function instead of your code?

    Kind Regards

    Giani Noyez

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans