D365 How do I refresh a subgrid with javascript?

54 views Asked by At

How should I go about refreshing a subgrid when I submit a child form?

So, I'm opening a D365 'main' form by selecting a row in a subgrid, using the Xrm.Navigation objects in .js like so:

function runOnSelected(executionContext) {
    var formContext = executionContext.getFormContext();
    var selected = executionContext.getFormContext().data.entity;
    var Id = selected.getId();

    var pageInput = {
        pageType: "entityrecord",
        entityName: "wmc_recordtype",
        entityId: Id,
        createFromEntity: { entityType: "wmc_recordtype", id: Id },
        formId: "08bb0ec9-da8a-ee11-8179-000d3a9bcf11"
    };

    var navigationOptions = {
        target: 2,
        width: { value: 25, unit: "%" },
        height: { value: 100, unit: "%" },
        position: 2
    };

    Xrm.Navigation.navigateTo(pageInput, navigationOptions).then(
        function success() {
        },
        function error() {
        }
    );
}

The form pops and there is some data that I can enter. All that works, and when I save the database is updated. The last piece is to refresh the subgrid I initially clicked to pop the form so it shows the updated data.

I feel like there is something I should be able to do in the success() function but not sure how to get back to the parent page context?

Help?

0

There are 0 answers