locked
Refresh Quickviews' Subgrid RRS feed

  • Question

  • I have a quickview form of account which has a subgrid of "Licence Allocations" - a custom entity.

    Sales people will need to know the data in this subgrid when creating a quote so I have added the quickview to the quote form. However it doesn't refresh when the potential customer is added or when the record is initially saved. It only shows when going in to an existing quote record.

    I have created the following javascript but it doesn't seem to be working, i.e. not refreshing the subgrid or the form and I'm left with "To enable this content, create the record". I've registered it onSave, onChange of potential customer and onChange on ModifiedOn none of which refresh the subgrid. The onChange of ModifiedOn is the only one that gives me the record Guid.

    function refreshSubGrid() {
        var quickViewControl = Xrm.Page.ui.quickForms.get("AccountLicenceInformation");//ui.quickForms.
        alert("3");
        alert(Xrm.Page.data.entity.getId());
        if (quickViewControl != undefined) {
            if (quickViewControl.isLoaded()) {
                setTimeout(function () {
                    quickViewControl.refresh();
                    var emailsGrid = quickViewControl.getControl("licenceallocations");
                    emailsGrid.refresh();
                }, 500);
                alert("done");
            } else
                alert("err 1");
        } else
            alert("err 2");
    }


    • Edited by ChrisJC119 Monday, July 17, 2017 1:02 PM More info
    Monday, July 17, 2017 12:51 PM

Answers

  • I think the error is in the caps of the quickform name. The following works:

    function refreshSubGrid() {
        var quickViewControl = Xrm.Page.ui.quickForms.get("accountlicenceinformation");
        if (quickViewControl != undefined) {
            if (quickViewControl.isLoaded()) {
                setTimeout(function () {
                    //quickViewControl.refresh();
                    var emailsGrid = quickViewControl.getControl("licenceallocations");
                    emailsGrid.refresh();
                }, 500);
            } 
        } 
    }

    • Marked as answer by ChrisJC119 Monday, July 17, 2017 3:57 PM
    Monday, July 17, 2017 3:57 PM