web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Editable Grid onchange...
Power Apps
Unanswered

Editable Grid onchange Help - formContext.getcontrol() not working

(0) ShareShare
ReportReport
Posted on by 20
Request: Save editable subgrid records on change
 
I need to implement javascript that will save the edited record, or all records within a subgrid, when fields are modified. This sounds straightforward, but I have been having major issues with formContext.getcontrol being able to even find the subgrid to interact with. It is especially frustrating since I implemented an on load event to ensure the subgrid is available and initialized prior to the script running, and it checked out fine. Here is the code that I am using that is not locating the subgrid:
 
function doSomething(executionContext) {
    var formContext = executionContext.getFormContext();
    }

    var subgridControl = formContext.getControl("ProductInventories");
    
    if (!subgridControl) {
        console.error("Subgrid control 'ProductInventories' not found using formContext.");
        return;
    }

    console.log("Subgrid control 'ProductInventories' found using formContext.");
    // Perform operations on the subgrid
}
 
Any way I have tried to spin this, I get the same error, "Subgrid control 'ProductInventories' found using formContext." Interestingly, the subgrid was indeed found using xrm.page.getcontrol:
 
function doSomething() {
    var subgridControl = Xrm.Page.getControl("ProductInventories");

    if (!subgridControl) {
        console.error("Subgrid control 'ProductInventories' not found using Xrm.Page.");
        return;
    }

    console.log("Subgrid control 'ProductInventories' found using Xrm.Page.");
    // Perform operations on the subgrid
}
 
 
I really just need some suggestions on how to best implement this. For more context, I have a form with the subgrid in question, and several rollup fields on that form that pull data from the editable subgrid. When data is updated in the subgrid, they are not truly saved, which of course causes major issues when those rollup fields need to always be current.
 
 
Please help, thank you!
Categories:
I have the same question (0)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 88

#2
WarrenBelz Profile Picture

WarrenBelz 85 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 45

Last 30 days Overall leaderboard